FIXME SR is private
This commit is contained in:
parent
8929cc9bfa
commit
123283f277
576 changed files with 75350 additions and 13070 deletions
|
|
@ -1,10 +1,7 @@
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical;
|
||||
|
||||
|
|
@ -22,7 +19,7 @@ namespace Yavsc.Controllers
|
|||
// GET: InstrumentRating
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var applicationDbContext =
|
||||
_context.InstrumentRating
|
||||
.Include(i => i.Profile)
|
||||
|
|
@ -37,15 +34,15 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
InstrumentRating instrumentRating = await _context.InstrumentRating
|
||||
.Include(i => i.Instrument).SingleAsync(m => m.Id == id);
|
||||
if (instrumentRating == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(instrumentRating);
|
||||
|
|
@ -54,7 +51,7 @@ namespace Yavsc.Controllers
|
|||
// GET: InstrumentRating/Create
|
||||
public async Task<IActionResult> Create()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
var actual = await _context.InstrumentRating
|
||||
.Where(m => m.OwnerId == uid). Select( r => r.InstrumentId ).ToArrayAsync();
|
||||
|
|
@ -88,13 +85,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
InstrumentRating instrumentRating = await _context.InstrumentRating.SingleAsync(m => m.Id == id);
|
||||
if (instrumentRating == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
ViewData["OwnerId"] = new SelectList(_context.Performers, "PerformerId", "Profile", instrumentRating.OwnerId);
|
||||
return View(instrumentRating);
|
||||
|
|
@ -121,14 +118,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
InstrumentRating instrumentRating = await _context.InstrumentRating
|
||||
.Include(i => i.Instrument).SingleAsync(m => m.Id == id);
|
||||
if (instrumentRating == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(instrumentRating);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical.Profiles;
|
||||
|
||||
|
|
@ -31,13 +30,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||
if (musicianSettings == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(musicianSettings);
|
||||
|
|
@ -46,7 +45,7 @@ namespace Yavsc.Controllers
|
|||
// GET: Instrumentation/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var owned = _context.Instrumentation.Include(i=>i.Tool).Where(i=>i.UserId==uid).Select(i=>i.InstrumentId);
|
||||
var ownedArray = owned.ToArray();
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ namespace Yavsc.Controllers
|
|||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(Instrumentation model)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
if (model.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||
|
|
@ -77,17 +76,17 @@ namespace Yavsc.Controllers
|
|||
// GET: Instrumentation/Edit/5
|
||||
public async Task<IActionResult> Edit(string id)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
if (id != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new ChallengeResult();
|
||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||
if (musicianSettings == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
return View(musicianSettings);
|
||||
}
|
||||
|
|
@ -97,7 +96,7 @@ namespace Yavsc.Controllers
|
|||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(Instrumentation musicianSettings)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new ChallengeResult();
|
||||
if (ModelState.IsValid)
|
||||
|
|
@ -115,15 +114,15 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||
if (musicianSettings == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new ChallengeResult();
|
||||
return View(musicianSettings);
|
||||
|
|
@ -136,7 +135,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new ChallengeResult();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Security.Claims;
|
||||
using Models;
|
||||
using Models.Musical;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
public class InstrumentsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
|
@ -26,13 +28,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||
if (instrument == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(instrument);
|
||||
|
|
@ -63,13 +65,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||
if (instrument == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
return View(instrument);
|
||||
}
|
||||
|
|
@ -94,13 +96,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||
if (instrument == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(instrument);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue