re-organisation
parent
4f3432f73f
commit
4ae095ccb3
@ -1,122 +1,122 @@
|
|||||||
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class CircleController : Controller
|
public class CircleController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CircleController(ApplicationDbContext context)
|
public CircleController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Circle
|
// GET: Circle
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Circle.ToListAsync());
|
return View(await _context.Circle.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Circle/Details/5
|
// GET: Circle/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||||
if (circle == null)
|
if (circle == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(circle);
|
return View(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Circle/Create
|
// GET: Circle/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Circle/Create
|
// POST: Circle/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Circle circle)
|
public async Task<IActionResult> Create(Circle circle)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Circle.Add(circle);
|
_context.Circle.Add(circle);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(circle);
|
return View(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Circle/Edit/5
|
// GET: Circle/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||||
if (circle == null)
|
if (circle == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(circle);
|
return View(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Circle/Edit/5
|
// POST: Circle/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Circle circle)
|
public async Task<IActionResult> Edit(Circle circle)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(circle);
|
_context.Update(circle);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(circle);
|
return View(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Circle/Delete/5
|
// GET: Circle/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||||
if (circle == null)
|
if (circle == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(circle);
|
return View(circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Circle/Delete/5
|
// POST: Circle/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||||
_context.Circle.Remove(circle);
|
_context.Circle.Remove(circle);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,135 +1,135 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class CircleMembersController : Controller
|
public class CircleMembersController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CircleMembersController(ApplicationDbContext context)
|
public CircleMembersController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CircleMembers
|
// GET: CircleMembers
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
var applicationDbContext = _context.CircleMembers.Include(c => c.Circle).Include(c => c.Member)
|
var applicationDbContext = _context.CircleMembers.Include(c => c.Circle).Include(c => c.Member)
|
||||||
.Where(c=>c.Circle.OwnerId == uid);
|
.Where(c=>c.Circle.OwnerId == uid);
|
||||||
return View(await applicationDbContext.ToListAsync());
|
return View(await applicationDbContext.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CircleMembers/Details/5
|
// GET: CircleMembers/Details/5
|
||||||
public async Task<IActionResult> Details(long id)
|
public async Task<IActionResult> Details(long id)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
|
|
||||||
CircleMember circleMember = await _context.CircleMembers
|
CircleMember circleMember = await _context.CircleMembers
|
||||||
.Include(m=>m.Circle)
|
.Include(m=>m.Circle)
|
||||||
.FirstOrDefaultAsync(c=>c.CircleId == id);
|
.FirstOrDefaultAsync(c=>c.CircleId == id);
|
||||||
if (circleMember == null)
|
if (circleMember == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(circleMember);
|
return View(circleMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CircleMembers/Create
|
// GET: CircleMembers/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
ViewBag.CircleId = new SelectList(_context.Circle.Where(c=>c.OwnerId == uid), "Id", "Name");
|
ViewBag.CircleId = new SelectList(_context.Circle.Where(c=>c.OwnerId == uid), "Id", "Name");
|
||||||
ViewBag.MemberId = new SelectList(_context.Users, "Id", "UserName");
|
ViewBag.MemberId = new SelectList(_context.Users, "Id", "UserName");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: CircleMembers/Create
|
// POST: CircleMembers/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(CircleMember circleMember)
|
public async Task<IActionResult> Create(CircleMember circleMember)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
var circle = _context.Circle.SingleOrDefault(c=>c.OwnerId == uid && c.Id == circleMember.CircleId);
|
var circle = _context.Circle.SingleOrDefault(c=>c.OwnerId == uid && c.Id == circleMember.CircleId);
|
||||||
if (circle==null)
|
if (circle==null)
|
||||||
return new BadRequestResult();
|
return new BadRequestResult();
|
||||||
|
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.CircleMembers.Add(circleMember);
|
_context.CircleMembers.Add(circleMember);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Name", circleMember.CircleId);
|
ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Name", circleMember.CircleId);
|
||||||
ViewData["MemberId"] = new SelectList(_context.Users, "Id", "UserName", circleMember.MemberId);
|
ViewData["MemberId"] = new SelectList(_context.Users, "Id", "UserName", circleMember.MemberId);
|
||||||
return View(circleMember);
|
return View(circleMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CircleMembers/Edit/5
|
// GET: CircleMembers/Edit/5
|
||||||
public async Task<IActionResult> Edit(long id)
|
public async Task<IActionResult> Edit(long id)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
CircleMember circleMember = await _context.CircleMembers
|
CircleMember circleMember = await _context.CircleMembers
|
||||||
.Include(m=>m.Member)
|
.Include(m=>m.Member)
|
||||||
.SingleOrDefaultAsync(m => m.CircleId == id && m.MemberId == uid);
|
.SingleOrDefaultAsync(m => m.CircleId == id && m.MemberId == uid);
|
||||||
if (circleMember == null)
|
if (circleMember == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(circleMember);
|
return View(circleMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: CircleMembers/Edit/5
|
// POST: CircleMembers/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(CircleMember circleMember)
|
public async Task<IActionResult> Edit(CircleMember circleMember)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(circleMember);
|
_context.Update(circleMember);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Circle", circleMember.CircleId);
|
ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Circle", circleMember.CircleId);
|
||||||
ViewData["MemberId"] = new SelectList(_context.Users, "Id", "Member", circleMember.MemberId);
|
ViewData["MemberId"] = new SelectList(_context.Users, "Id", "Member", circleMember.MemberId);
|
||||||
return View(circleMember);
|
return View(circleMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CircleMembers/Delete/5
|
// GET: CircleMembers/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long id)
|
public async Task<IActionResult> Delete(long id)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
|
|
||||||
CircleMember circleMember = await _context.CircleMembers
|
CircleMember circleMember = await _context.CircleMembers
|
||||||
.Include(m=>m.Circle)
|
.Include(m=>m.Circle)
|
||||||
.Include(m=>m.Member)
|
.Include(m=>m.Member)
|
||||||
.SingleOrDefaultAsync(m => m.CircleId == id && m.MemberId == uid);
|
.SingleOrDefaultAsync(m => m.CircleId == id && m.MemberId == uid);
|
||||||
if (circleMember == null)
|
if (circleMember == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(circleMember);
|
return View(circleMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: CircleMembers/Delete/5
|
// POST: CircleMembers/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
CircleMember circleMember = await _context.CircleMembers.SingleAsync(m => m.CircleId == id);
|
CircleMember circleMember = await _context.CircleMembers.SingleAsync(m => m.CircleId == id);
|
||||||
_context.CircleMembers.Remove(circleMember);
|
_context.CircleMembers.Remove(circleMember);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,139 +1,139 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Auth;
|
using Yavsc.Models.Auth;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class ClientController : Controller
|
public class ClientController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ClientController(ApplicationDbContext context)
|
public ClientController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Client
|
// GET: Client
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Applications.ToListAsync());
|
return View(await _context.Applications.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Client/Details/5
|
// GET: Client/Details/5
|
||||||
public async Task<IActionResult> Details(string id)
|
public async Task<IActionResult> Details(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
||||||
if (client == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(client);
|
return View(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Client/Create
|
// GET: Client/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
SetAppTypesInputValues();
|
SetAppTypesInputValues();
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Client/Create
|
// POST: Client/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Client client)
|
public async Task<IActionResult> Create(Client client)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
client.Id = Guid.NewGuid().ToString();
|
client.Id = Guid.NewGuid().ToString();
|
||||||
_context.Applications.Add(client);
|
_context.Applications.Add(client);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
SetAppTypesInputValues();
|
SetAppTypesInputValues();
|
||||||
return View(client);
|
return View(client);
|
||||||
}
|
}
|
||||||
private void SetAppTypesInputValues()
|
private void SetAppTypesInputValues()
|
||||||
{
|
{
|
||||||
IEnumerable<SelectListItem> types = new SelectListItem[] {
|
IEnumerable<SelectListItem> types = new SelectListItem[] {
|
||||||
new SelectListItem {
|
new SelectListItem {
|
||||||
Text = ApplicationTypes.JavaScript.ToString(),
|
Text = ApplicationTypes.JavaScript.ToString(),
|
||||||
Value = ((int) ApplicationTypes.JavaScript).ToString() },
|
Value = ((int) ApplicationTypes.JavaScript).ToString() },
|
||||||
new SelectListItem {
|
new SelectListItem {
|
||||||
Text = ApplicationTypes.NativeConfidential.ToString(),
|
Text = ApplicationTypes.NativeConfidential.ToString(),
|
||||||
Value = ((int) ApplicationTypes.NativeConfidential).ToString()
|
Value = ((int) ApplicationTypes.NativeConfidential).ToString()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ViewData["Type"] = types;
|
ViewData["Type"] = types;
|
||||||
}
|
}
|
||||||
// GET: Client/Edit/5
|
// GET: Client/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
||||||
if (client == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
SetAppTypesInputValues();
|
SetAppTypesInputValues();
|
||||||
return View(client);
|
return View(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Client/Edit/5
|
// POST: Client/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Client client)
|
public async Task<IActionResult> Edit(Client client)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(client);
|
_context.Update(client);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(client);
|
return View(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Client/Delete/5
|
// GET: Client/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(string id)
|
public async Task<IActionResult> Delete(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
||||||
if (client == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(client);
|
return View(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Client/Delete/5
|
// POST: Client/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
|
||||||
_context.Applications.Remove(client);
|
_context.Applications.Remove(client);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,131 +1,131 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Workflow;
|
using Yavsc.Models.Workflow;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class CommandFormsController : Controller
|
public class CommandFormsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CommandFormsController(ApplicationDbContext context)
|
public CommandFormsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CommandForms
|
// GET: CommandForms
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var applicationDbContext = _context.CommandForm.Include(c => c.Context);
|
var applicationDbContext = _context.CommandForm.Include(c => c.Context);
|
||||||
return View(await applicationDbContext.ToListAsync());
|
return View(await applicationDbContext.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CommandForms/Details/5
|
// GET: CommandForms/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||||
if (commandForm == null)
|
if (commandForm == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(commandForm);
|
return View(commandForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CommandForms/Create
|
// GET: CommandForms/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
SetViewBag();
|
SetViewBag();
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
private void SetViewBag(CommandForm commandForm=null) {
|
private void SetViewBag(CommandForm commandForm=null) {
|
||||||
ViewBag.ActivityCode = new SelectList(_context.Activities, "Code", "Name", commandForm?.ActivityCode);
|
ViewBag.ActivityCode = new SelectList(_context.Activities, "Code", "Name", commandForm?.ActivityCode);
|
||||||
ViewBag.ActionName = Startup.Forms.Select( c => new SelectListItem { Value = c, Text = c, Selected = (commandForm?.ActionName == c) } );
|
ViewBag.ActionName = Startup.Forms.Select( c => new SelectListItem { Value = c, Text = c, Selected = (commandForm?.ActionName == c) } );
|
||||||
}
|
}
|
||||||
// POST: CommandForms/Create
|
// POST: CommandForms/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(CommandForm commandForm)
|
public async Task<IActionResult> Create(CommandForm commandForm)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.CommandForm.Add(commandForm);
|
_context.CommandForm.Add(commandForm);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
SetViewBag(commandForm);
|
SetViewBag(commandForm);
|
||||||
return View(commandForm);
|
return View(commandForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CommandForms/Edit/5
|
// GET: CommandForms/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||||
if (commandForm == null)
|
if (commandForm == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
SetViewBag(commandForm);
|
SetViewBag(commandForm);
|
||||||
return View(commandForm);
|
return View(commandForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: CommandForms/Edit/5
|
// POST: CommandForms/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(CommandForm commandForm)
|
public async Task<IActionResult> Edit(CommandForm commandForm)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(commandForm);
|
_context.Update(commandForm);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
SetViewBag(commandForm);
|
SetViewBag(commandForm);
|
||||||
return View(commandForm);
|
return View(commandForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CommandForms/Delete/5
|
// GET: CommandForms/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||||
if (commandForm == null)
|
if (commandForm == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(commandForm);
|
return View(commandForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: CommandForms/Delete/5
|
// POST: CommandForms/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||||
_context.CommandForm.Remove(commandForm);
|
_context.CommandForm.Remove(commandForm);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,120 +1,120 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical.Profiles;
|
using Yavsc.Models.Musical.Profiles;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class DjSettingsController : Controller
|
public class DjSettingsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public DjSettingsController(ApplicationDbContext context)
|
public DjSettingsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: DjSettings
|
// GET: DjSettings
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.DjSettings.ToListAsync());
|
return View(await _context.DjSettings.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: DjSettings/Details/5
|
// GET: DjSettings/Details/5
|
||||||
public async Task<IActionResult> Details(string id)
|
public async Task<IActionResult> Details(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (djSettings == null)
|
if (djSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(djSettings);
|
return View(djSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: DjSettings/Create
|
// GET: DjSettings/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: DjSettings/Create
|
// POST: DjSettings/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(DjSettings djSettings)
|
public async Task<IActionResult> Create(DjSettings djSettings)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.DjSettings.Add(djSettings);
|
_context.DjSettings.Add(djSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(djSettings);
|
return View(djSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: DjSettings/Edit/5
|
// GET: DjSettings/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (djSettings == null)
|
if (djSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(djSettings);
|
return View(djSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: DjSettings/Edit/5
|
// POST: DjSettings/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(DjSettings djSettings)
|
public async Task<IActionResult> Edit(DjSettings djSettings)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(djSettings);
|
_context.Update(djSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(djSettings);
|
return View(djSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: DjSettings/Delete/5
|
// GET: DjSettings/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(string id)
|
public async Task<IActionResult> Delete(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (djSettings == null)
|
if (djSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(djSettings);
|
return View(djSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: DjSettings/Delete/5
|
// POST: DjSettings/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||||
_context.DjSettings.Remove(djSettings);
|
_context.DjSettings.Remove(djSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using Yavsc.Controllers.Generic;
|
using Yavsc.Controllers.Generic;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Workflow.Profiles;
|
using Yavsc.Models.Workflow.Profiles;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class FormationSettingsController : SettingsController<FormationSettings>
|
public class FormationSettingsController : SettingsController<FormationSettings>
|
||||||
{
|
{
|
||||||
|
|
||||||
public FormationSettingsController(ApplicationDbContext context) : base(context)
|
public FormationSettingsController(ApplicationDbContext context) : base(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,121 +1,121 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Forms;
|
using Yavsc.Models.Forms;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class FormsController : Controller
|
public class FormsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public FormsController(ApplicationDbContext context)
|
public FormsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Forms
|
// GET: Forms
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Form.ToListAsync());
|
return View(await _context.Form.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Forms/Details/5
|
// GET: Forms/Details/5
|
||||||
public async Task<IActionResult> Details(string id)
|
public async Task<IActionResult> Details(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||||
if (form == null)
|
if (form == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(form);
|
return View(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Forms/Create
|
// GET: Forms/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Forms/Create
|
// POST: Forms/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Form form)
|
public async Task<IActionResult> Create(Form form)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Form.Add(form);
|
_context.Form.Add(form);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(form);
|
return View(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Forms/Edit/5
|
// GET: Forms/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||||
if (form == null)
|
if (form == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(form);
|
return View(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Forms/Edit/5
|
// POST: Forms/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Form form)
|
public async Task<IActionResult> Edit(Form form)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(form);
|
_context.Update(form);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(form);
|
return View(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Forms/Delete/5
|
// GET: Forms/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(string id)
|
public async Task<IActionResult> Delete(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||||
if (form == null)
|
if (form == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(form);
|
return View(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Forms/Delete/5
|
// POST: Forms/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||||
_context.Form.Remove(form);
|
_context.Form.Remove(form);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,120 +1,120 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical.Profiles;
|
using Yavsc.Models.Musical.Profiles;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class GeneralSettingsController : Controller
|
public class GeneralSettingsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public GeneralSettingsController(ApplicationDbContext context)
|
public GeneralSettingsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GeneralSettings
|
// GET: GeneralSettings
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.GeneralSettings.ToListAsync());
|
return View(await _context.GeneralSettings.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GeneralSettings/Details/5
|
// GET: GeneralSettings/Details/5
|
||||||
public async Task<IActionResult> Details(string id)
|
public async Task<IActionResult> Details(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (generalSettings == null)
|
if (generalSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(generalSettings);
|
return View(generalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GeneralSettings/Create
|
// GET: GeneralSettings/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: GeneralSettings/Create
|
// POST: GeneralSettings/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(GeneralSettings generalSettings)
|
public async Task<IActionResult> Create(GeneralSettings generalSettings)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.GeneralSettings.Add(generalSettings);
|
_context.GeneralSettings.Add(generalSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(generalSettings);
|
return View(generalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GeneralSettings/Edit/5
|
// GET: GeneralSettings/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (generalSettings == null)
|
if (generalSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(generalSettings);
|
return View(generalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: GeneralSettings/Edit/5
|
// POST: GeneralSettings/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(GeneralSettings generalSettings)
|
public async Task<IActionResult> Edit(GeneralSettings generalSettings)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(generalSettings);
|
_context.Update(generalSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(generalSettings);
|
return View(generalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GeneralSettings/Delete/5
|
// GET: GeneralSettings/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(string id)
|
public async Task<IActionResult> Delete(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||||
if (generalSettings == null)
|
if (generalSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(generalSettings);
|
return View(generalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: GeneralSettings/Delete/5
|
// POST: GeneralSettings/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||||
_context.GeneralSettings.Remove(generalSettings);
|
_context.GeneralSettings.Remove(generalSettings);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,17 +1,17 @@
|
|||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Yavsc.Controllers.Generic;
|
using Yavsc.Controllers.Generic;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
[Authorize(Roles="Performer")]
|
[Authorize(Roles="Performer")]
|
||||||
public class BrusherProfileController : SettingsController<BrusherProfile>
|
public class BrusherProfileController : SettingsController<BrusherProfile>
|
||||||
{
|
{
|
||||||
public BrusherProfileController(ApplicationDbContext context) : base(context)
|
public BrusherProfileController(ApplicationDbContext context) : base(context)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,121 +1,121 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Drawing;
|
using Yavsc.Models.Drawing;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class ColorsController : Controller
|
public class ColorsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ColorsController(ApplicationDbContext context)
|
public ColorsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Colors
|
// GET: Colors
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Color.ToListAsync());
|
return View(await _context.Color.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Colors/Details/5
|
// GET: Colors/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
||||||
if (color == null)
|
if (color == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(color);
|
return View(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Colors/Create
|
// GET: Colors/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View(new Color());
|
return View(new Color());
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Colors/Create
|
// POST: Colors/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Color color)
|
public async Task<IActionResult> Create(Color color)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Color.Add(color);
|
_context.Color.Add(color);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(color);
|
return View(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Colors/Edit/5
|
// GET: Colors/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
||||||
if (color == null)
|
if (color == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(color);
|
return View(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Colors/Edit/5
|
// POST: Colors/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Color color)
|
public async Task<IActionResult> Edit(Color color)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(color);
|
_context.Update(color);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(color);
|
return View(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Colors/Delete/5
|
// GET: Colors/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
||||||
if (color == null)
|
if (color == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(color);
|
return View(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Colors/Delete/5
|
// POST: Colors/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
Color color = await _context.Color.SingleAsync(m => m.Id == id);
|
||||||
_context.Color.Remove(color);
|
_context.Color.Remove(color);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,120 +1,120 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class HairPrestationsController : Controller
|
public class HairPrestationsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public HairPrestationsController(ApplicationDbContext context)
|
public HairPrestationsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairPrestations
|
// GET: HairPrestations
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.HairPrestation.ToListAsync());
|
return View(await _context.HairPrestation.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairPrestations/Details/5
|
// GET: HairPrestations/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||||
if (hairPrestation == null)
|
if (hairPrestation == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(hairPrestation);
|
return View(hairPrestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairPrestations/Create
|
// GET: HairPrestations/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairPrestations/Create
|
// POST: HairPrestations/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(HairPrestation hairPrestation)
|
public async Task<IActionResult> Create(HairPrestation hairPrestation)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.HairPrestation.Add(hairPrestation);
|
_context.HairPrestation.Add(hairPrestation);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(hairPrestation);
|
return View(hairPrestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairPrestations/Edit/5
|
// GET: HairPrestations/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||||
if (hairPrestation == null)
|
if (hairPrestation == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(hairPrestation);
|
return View(hairPrestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairPrestations/Edit/5
|
// POST: HairPrestations/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(HairPrestation hairPrestation)
|
public async Task<IActionResult> Edit(HairPrestation hairPrestation)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(hairPrestation);
|
_context.Update(hairPrestation);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(hairPrestation);
|
return View(hairPrestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairPrestations/Delete/5
|
// GET: HairPrestations/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||||
if (hairPrestation == null)
|
if (hairPrestation == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(hairPrestation);
|
return View(hairPrestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairPrestations/Delete/5
|
// POST: HairPrestations/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||||
_context.HairPrestation.Remove(hairPrestation);
|
_context.HairPrestation.Remove(hairPrestation);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,129 +1,129 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class HairTaintsController : Controller
|
public class HairTaintsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public HairTaintsController(ApplicationDbContext context)
|
public HairTaintsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairTaints
|
// GET: HairTaints
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var applicationDbContext = _context.HairTaint.Include(h => h.Color);
|
var applicationDbContext = _context.HairTaint.Include(h => h.Color);
|
||||||
return View(await applicationDbContext.ToListAsync());
|
return View(await applicationDbContext.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairTaints/Details/5
|
// GET: HairTaints/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
||||||
if (hairTaint == null)
|
if (hairTaint == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(hairTaint);
|
return View(hairTaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairTaints/Create
|
// GET: HairTaints/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name");
|
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairTaints/Create
|
// POST: HairTaints/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(HairTaint hairTaint)
|
public async Task<IActionResult> Create(HairTaint hairTaint)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.HairTaint.Add(hairTaint);
|
_context.HairTaint.Add(hairTaint);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId);
|
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId);
|
||||||
return View(hairTaint);
|
return View(hairTaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairTaints/Edit/5
|
// GET: HairTaints/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
||||||
if (hairTaint == null)
|
if (hairTaint == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name",hairTaint.ColorId);
|
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name",hairTaint.ColorId);
|
||||||
return View(hairTaint);
|
return View(hairTaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairTaints/Edit/5
|
// POST: HairTaints/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(HairTaint hairTaint)
|
public async Task<IActionResult> Edit(HairTaint hairTaint)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(hairTaint);
|
_context.Update(hairTaint);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId);
|
ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId);
|
||||||
return View(hairTaint);
|
return View(hairTaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HairTaints/Delete/5
|
// GET: HairTaints/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
||||||
if (hairTaint == null)
|
if (hairTaint == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(hairTaint);
|
return View(hairTaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: HairTaints/Delete/5
|
// POST: HairTaints/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id);
|
||||||
_context.HairTaint.Remove(hairTaint);
|
_context.HairTaint.Remove(hairTaint);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,149 +1,149 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical.Profiles;
|
using Yavsc.Models.Musical.Profiles;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class InstrumentationController : Controller
|
public class InstrumentationController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public InstrumentationController(ApplicationDbContext context)
|
public InstrumentationController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instrumentation
|
// GET: Instrumentation
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Instrumentation.ToListAsync());
|
return View(await _context.Instrumentation.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instrumentation/Details/5
|
// GET: Instrumentation/Details/5
|
||||||
public async Task<IActionResult> Details(string id)
|
public async Task<IActionResult> Details(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||||
if (musicianSettings == null)
|
if (musicianSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(musicianSettings);
|
return View(musicianSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instrumentation/Create
|
// GET: Instrumentation/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
var owned = _context.Instrumentation.Include(i=>i.Tool).Where(i=>i.UserId==uid).Select(i=>i.InstrumentId);
|
var owned = _context.Instrumentation.Include(i=>i.Tool).Where(i=>i.UserId==uid).Select(i=>i.InstrumentId);
|
||||||
var ownedArray = owned.ToArray();
|
var ownedArray = owned.ToArray();
|
||||||
|
|
||||||
ViewBag.YetAvailableInstruments = _context.Instrument.Select(k=>new SelectListItem
|
ViewBag.YetAvailableInstruments = _context.Instrument.Select(k=>new SelectListItem
|
||||||
{ Text = k.Name, Value = k.Id.ToString(), Disabled = ownedArray.Contains(k.Id) });
|
{ Text = k.Name, Value = k.Id.ToString(), Disabled = ownedArray.Contains(k.Id) });
|
||||||
|
|
||||||
return View(new Instrumentation { UserId = uid });
|
return View(new Instrumentation { UserId = uid });
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instrumentation/Create
|
// POST: Instrumentation/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Instrumentation model)
|
public async Task<IActionResult> Create(Instrumentation model)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
if (model.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
if (model.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
|
|
||||||
_context.Instrumentation.Add(model);
|
_context.Instrumentation.Add(model);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instrumentation/Edit/5
|
// GET: Instrumentation/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
if (id != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
if (id != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||||
if (musicianSettings == null)
|
if (musicianSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(musicianSettings);
|
return View(musicianSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instrumentation/Edit/5
|
// POST: Instrumentation/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Instrumentation musicianSettings)
|
public async Task<IActionResult> Edit(Instrumentation musicianSettings)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(musicianSettings);
|
_context.Update(musicianSettings);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(musicianSettings);
|
return View(musicianSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instrumentation/Delete/5
|
// GET: Instrumentation/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(string id)
|
public async Task<IActionResult> Delete(string id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||||
if (musicianSettings == null)
|
if (musicianSettings == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
return View(musicianSettings);
|
return View(musicianSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instrumentation/Delete/5
|
// POST: Instrumentation/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
Instrumentation musicianSettings = await _context.Instrumentation.SingleAsync(m => m.UserId == id);
|
||||||
|
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
if (musicianSettings.UserId != uid) if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
|
|
||||||
|
|
||||||
_context.Instrumentation.Remove(musicianSettings);
|
_context.Instrumentation.Remove(musicianSettings);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,120 +1,120 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Models;
|
using Models;
|
||||||
using Models.Musical;
|
using Models.Musical;
|
||||||
public class InstrumentsController : Controller
|
public class InstrumentsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public InstrumentsController(ApplicationDbContext context)
|
public InstrumentsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instruments
|
// GET: Instruments
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View(_context.Instrument.ToList());
|
return View(_context.Instrument.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instruments/Details/5
|
// GET: Instruments/Details/5
|
||||||
public IActionResult Details(long? id)
|
public IActionResult Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||||
if (instrument == null)
|
if (instrument == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(instrument);
|
return View(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instruments/Create
|
// GET: Instruments/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instruments/Create
|
// POST: Instruments/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult Create(Instrument instrument)
|
public IActionResult Create(Instrument instrument)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Instrument.Add(instrument);
|
_context.Instrument.Add(instrument);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(instrument);
|
return View(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instruments/Edit/5
|
// GET: Instruments/Edit/5
|
||||||
public IActionResult Edit(long? id)
|
public IActionResult Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||||
if (instrument == null)
|
if (instrument == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(instrument);
|
return View(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instruments/Edit/5
|
// POST: Instruments/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult Edit(Instrument instrument)
|
public IActionResult Edit(Instrument instrument)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(instrument);
|
_context.Update(instrument);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(instrument);
|
return View(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Instruments/Delete/5
|
// GET: Instruments/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public IActionResult Delete(long? id)
|
public IActionResult Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||||
if (instrument == null)
|
if (instrument == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(instrument);
|
return View(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Instruments/Delete/5
|
// POST: Instruments/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult DeleteConfirmed(long id)
|
public IActionResult DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
Instrument instrument = _context.Instrument.Single(m => m.Id == id);
|
||||||
_context.Instrument.Remove(instrument);
|
_context.Instrument.Remove(instrument);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,120 +1,120 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Models;
|
using Models;
|
||||||
using Models.Musical;
|
using Models.Musical;
|
||||||
public class MusicalTendenciesController : Controller
|
public class MusicalTendenciesController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public MusicalTendenciesController(ApplicationDbContext context)
|
public MusicalTendenciesController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: MusicalTendencies
|
// GET: MusicalTendencies
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View(_context.MusicalTendency.ToList());
|
return View(_context.MusicalTendency.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: MusicalTendencies/Details/5
|
// GET: MusicalTendencies/Details/5
|
||||||
public IActionResult Details(long? id)
|
public IActionResult Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||||
if (musicalTendency == null)
|
if (musicalTendency == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(musicalTendency);
|
return View(musicalTendency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: MusicalTendencies/Create
|
// GET: MusicalTendencies/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: MusicalTendencies/Create
|
// POST: MusicalTendencies/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult Create(MusicalTendency musicalTendency)
|
public IActionResult Create(MusicalTendency musicalTendency)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.MusicalTendency.Add(musicalTendency);
|
_context.MusicalTendency.Add(musicalTendency);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(musicalTendency);
|
return View(musicalTendency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: MusicalTendencies/Edit/5
|
// GET: MusicalTendencies/Edit/5
|
||||||
public IActionResult Edit(long? id)
|
public IActionResult Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||||
if (musicalTendency == null)
|
if (musicalTendency == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(musicalTendency);
|
return View(musicalTendency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: MusicalTendencies/Edit/5
|
// POST: MusicalTendencies/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult Edit(MusicalTendency musicalTendency)
|
public IActionResult Edit(MusicalTendency musicalTendency)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(musicalTendency);
|
_context.Update(musicalTendency);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(musicalTendency);
|
return View(musicalTendency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: MusicalTendencies/Delete/5
|
// GET: MusicalTendencies/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public IActionResult Delete(long? id)
|
public IActionResult Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||||
if (musicalTendency == null)
|
if (musicalTendency == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(musicalTendency);
|
return View(musicalTendency);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: MusicalTendencies/Delete/5
|
// POST: MusicalTendencies/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public IActionResult DeleteConfirmed(long id)
|
public IActionResult DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||||
_context.MusicalTendency.Remove(musicalTendency);
|
_context.MusicalTendency.Remove(musicalTendency);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,121 +1,121 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Messaging;
|
using Yavsc.Models.Messaging;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
public class NotificationsController : Controller
|
public class NotificationsController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public NotificationsController(ApplicationDbContext context)
|
public NotificationsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Notifications
|
// GET: Notifications
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Notification.ToListAsync());
|
return View(await _context.Notification.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Notifications/Details/5
|
// GET: Notifications/Details/5
|
||||||
public async Task<IActionResult> Details(long? id)
|
public async Task<IActionResult> Details(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
||||||
if (notification == null)
|
if (notification == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(notification);
|
return View(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Notifications/Create
|
// GET: Notifications/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Notifications/Create
|
// POST: Notifications/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(Notification notification)
|
public async Task<IActionResult> Create(Notification notification)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Notification.Add(notification);
|
_context.Notification.Add(notification);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(notification);
|
return View(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Notifications/Edit/5
|
// GET: Notifications/Edit/5
|
||||||
public async Task<IActionResult> Edit(long? id)
|
public async Task<IActionResult> Edit(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
||||||
if (notification == null)
|
if (notification == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(notification);
|
return View(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Notifications/Edit/5
|
// POST: Notifications/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Notification notification)
|
public async Task<IActionResult> Edit(Notification notification)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Update(notification);
|
_context.Update(notification);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
return View(notification);
|
return View(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Notifications/Delete/5
|
// GET: Notifications/Delete/5
|
||||||
[ActionName("Delete")]
|
[ActionName("Delete")]
|
||||||
public async Task<IActionResult> Delete(long? id)
|
public async Task<IActionResult> Delete(long? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
||||||
if (notification == null)
|
if (notification == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(notification);
|
return View(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: Notifications/Delete/5
|
// POST: Notifications/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
Notification notification = await _context.Notification.SingleAsync(m => m.Id == id);
|
||||||
_context.Notification.Remove(notification);
|
_context.Notification.Remove(notification);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue