reorg
This commit is contained in:
parent
d000f77098
commit
40e8e08690
3487 changed files with 39 additions and 21 deletions
207
src/Yavsc.Org/Controllers/Contracting/ActivityController.cs
Normal file
207
src/Yavsc.Org/Controllers/Contracting/ActivityController.cs
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models;
|
||||
using Models.Workflow;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Authorize("AdministratorOnly")]
|
||||
public class ActivityController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<ActivityController> SR;
|
||||
readonly ILogger logger;
|
||||
|
||||
public ActivityController(ApplicationDbContext context,
|
||||
IStringLocalizer<ActivityController> SR,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_context = context;
|
||||
this.SR = SR;
|
||||
logger=loggerFactory.CreateLogger<ActivityController>();
|
||||
}
|
||||
|
||||
// GET: Activity
|
||||
public IActionResult Index()
|
||||
{
|
||||
SetSettingClasseInfo();
|
||||
return View(_context.Activities.Include(a=>a.Parent).ToList());
|
||||
}
|
||||
|
||||
private void SetSettingClasseInfo(string currentCode = null)
|
||||
{
|
||||
var items = Config.ProfileTypes.Select(
|
||||
pt => new SelectListItem
|
||||
{
|
||||
Text = SR[pt.FullName],
|
||||
Value = pt.FullName,
|
||||
Selected = currentCode == pt.FullName
|
||||
}).ToList();
|
||||
items.Add(new SelectListItem { Text = SR[Constants.NoneCode], Value = Constants.NoneCode, Selected = currentCode == null});
|
||||
ViewBag.SettingsClassName = items;
|
||||
}
|
||||
|
||||
private List<SelectListItem> GetEligibleParent(string code)
|
||||
{
|
||||
// eligibles are those
|
||||
// who are not in descendence
|
||||
|
||||
var acts = _context.Activities.Where(
|
||||
a => a.Code != code
|
||||
).Select(a => new SelectListItem
|
||||
{
|
||||
Text = a.Name,
|
||||
Value = a.Code
|
||||
}).ToList();
|
||||
var nullItem = new SelectListItem { Text = SR[Constants.NoneCode], Value = Constants.NoneCode };
|
||||
acts.Add(nullItem);
|
||||
if (code == null) return acts;
|
||||
var existing = _context.Activities.Include(a => a.Children).FirstOrDefault(a => a.Code == code);
|
||||
if (existing == null) return acts;
|
||||
var pi = acts.FirstOrDefault(i => i.Value == existing.ParentCode);
|
||||
if (pi!=null) pi.Selected = true;
|
||||
else nullItem.Selected = true;
|
||||
RecursivelyFilterChild(acts, existing);
|
||||
return acts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filters a activity selection list
|
||||
/// in order to exclude any descendant
|
||||
/// from the eligible list at the <c>Parent</c> property.
|
||||
/// WARN! results in a infinite loop when
|
||||
/// data is corrupted and there is a circularity
|
||||
/// in the activity hierarchy graph (Parent/Children)
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <param name="activity"></param>
|
||||
private static void RecursivelyFilterChild(List<SelectListItem> list, Activity activity)
|
||||
{
|
||||
if (activity == null) return;
|
||||
if (activity.Children == null) return;
|
||||
if (list.Count == 0) return;
|
||||
foreach (var child in activity.Children)
|
||||
{
|
||||
RecursivelyFilterChild(list, child);
|
||||
var rem = list.FirstOrDefault(i => i.Value == child.Code);
|
||||
if (rem != null) list.Remove(rem);
|
||||
}
|
||||
}
|
||||
|
||||
// GET: Activity/Details/5
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Activity activity = _context.Activities.Single(m => m.Code == id);
|
||||
if (activity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(activity);
|
||||
}
|
||||
|
||||
// GET: Activity/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
SetSettingClasseInfo();
|
||||
ViewBag.ParentCode = GetEligibleParent(null);
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Activity/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(Activity activity)
|
||||
{
|
||||
if (activity.ParentCode==Constants.NoneCode)
|
||||
activity.ParentCode=null;
|
||||
if (activity.SettingsClassName==Constants.NoneCode)
|
||||
activity.SettingsClassName=null;
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Activities.Add(activity);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
SetSettingClasseInfo();
|
||||
return View(activity);
|
||||
}
|
||||
|
||||
// GET: Activity/Edit/5
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Activity activity = _context.Activities.Single(m => m.Code == id);
|
||||
if (activity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
ViewBag.ParentCode = GetEligibleParent(id);
|
||||
SetSettingClasseInfo();
|
||||
return View(activity);
|
||||
}
|
||||
|
||||
// POST: Activity/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(Activity activity)
|
||||
{
|
||||
if (activity.ParentCode==Constants.NoneCode)
|
||||
activity.ParentCode=null;
|
||||
if (activity.SettingsClassName==Constants.NoneCode)
|
||||
activity.SettingsClassName=null;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(activity);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(activity);
|
||||
}
|
||||
|
||||
// GET: Activity/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Activity activity = _context.Activities.Single(m => m.Code == id);
|
||||
if (activity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(activity);
|
||||
}
|
||||
|
||||
// POST: Activity/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
Activity activity = _context.Activities.Single(m => m.Code == id);
|
||||
_context.Activities.Remove(activity);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
131
src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs
Normal file
131
src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Workflow;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class CoWorkingController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CoWorkingController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: CoWorking
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var applicationDbContext = _context.CoWorking.Include(c => c.Performer).Include(c => c.WorkingFor);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: CoWorking/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||
if (coWorking == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(coWorking);
|
||||
}
|
||||
|
||||
// GET: CoWorking/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.PerformerId = _context.Performers.Select( p=> new SelectListItem { Value = p.PerformerId, Text = p.Performer.UserName});
|
||||
ViewBag.WorkingForId = new SelectList(_context.Users, "Id", "UserName");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: CoWorking/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(CoWorking coWorking)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.CoWorking.Add(coWorking);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId);
|
||||
ViewData["WorkingForId"] = new SelectList(_context.Users, "Id", "WorkingFor", coWorking.WorkingForId);
|
||||
return View(coWorking);
|
||||
}
|
||||
|
||||
// GET: CoWorking/Edit/5
|
||||
public async Task<IActionResult> Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||
if (coWorking == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId);
|
||||
ViewData["WorkingForId"] = new SelectList(_context.Users, "Id", "WorkingFor", coWorking.WorkingForId);
|
||||
return View(coWorking);
|
||||
}
|
||||
|
||||
// POST: CoWorking/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(CoWorking coWorking)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(coWorking);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId);
|
||||
ViewData["WorkingForId"] = new SelectList(_context.Users, "Id", "WorkingFor", coWorking.WorkingForId);
|
||||
return View(coWorking);
|
||||
}
|
||||
|
||||
// GET: CoWorking/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||
if (coWorking == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(coWorking);
|
||||
}
|
||||
|
||||
// POST: CoWorking/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||
{
|
||||
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||
_context.CoWorking.Remove(coWorking);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
276
src/Yavsc.Org/Controllers/Contracting/CommandController.cs
Normal file
276
src/Yavsc.Org/Controllers/Contracting/CommandController.cs
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Helpers;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Models;
|
||||
using Models.Google.Messaging;
|
||||
using Models.Relationship;
|
||||
using Models.Workflow;
|
||||
using Services;
|
||||
using Yavsc.Interface;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Settings;
|
||||
|
||||
public class CommandController : Controller
|
||||
{
|
||||
protected UserManager<ApplicationUser> _userManager;
|
||||
protected ApplicationDbContext _context;
|
||||
protected GoogleAuthSettings _googleSettings;
|
||||
protected IYavscMessageSender _MessageSender;
|
||||
protected ITrueEmailSender _emailSender;
|
||||
protected IStringLocalizer<CommandController> _localizer;
|
||||
protected SiteSettings _siteSettings;
|
||||
protected SmtpSettings _smtpSettings;
|
||||
protected ICalendarManager _calendarManager;
|
||||
|
||||
protected readonly ILogger _logger;
|
||||
public CommandController(ApplicationDbContext context, IOptions<GoogleAuthSettings> googleSettings,
|
||||
IYavscMessageSender messageSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ICalendarManager calendarManager,
|
||||
IStringLocalizer<CommandController> localizer,
|
||||
ITrueEmailSender emailSender,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_context = context;
|
||||
_MessageSender = messageSender;
|
||||
_emailSender = emailSender;
|
||||
_googleSettings = googleSettings.Value;
|
||||
_userManager = userManager;
|
||||
_smtpSettings = smtpSettings.Value;
|
||||
_siteSettings = siteSettings.Value;
|
||||
_calendarManager = calendarManager;
|
||||
_localizer = localizer;
|
||||
_logger = loggerFactory.CreateLogger<CommandController>();
|
||||
}
|
||||
|
||||
// GET: Command
|
||||
[Authorize]
|
||||
public virtual async Task<IActionResult> Index()
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
return View(await _context.RdvQueries
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.PerformerProfile)
|
||||
.Include(x => x.PerformerProfile.Performer)
|
||||
.Include(x => x.Location)
|
||||
.Where(x => x.ClientId == uid || x.PerformerId == uid)
|
||||
.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Command/Details/5
|
||||
public virtual async Task<IActionResult> Details(long id)
|
||||
{
|
||||
RdvQuery command = await _context.RdvQueries
|
||||
.Include(x => x.Location)
|
||||
.Include(x => x.PerformerProfile)
|
||||
.SingleAsync(m => m.Id == id);
|
||||
if (command == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives a view on
|
||||
/// Creating a command for a specified performer
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IActionResult Create(string proId, string activityCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(proId))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs a performer id (from parameter proId)"
|
||||
);
|
||||
if (string.IsNullOrWhiteSpace(activityCode))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs an activity code"
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
x => x.Performer).FirstOrDefault(
|
||||
x => x.PerformerId == proId
|
||||
);
|
||||
if (pro == null)
|
||||
return NotFound();
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == activityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
var userid = User.GetUserId();
|
||||
var user = _userManager.FindByIdAsync(userid).Result;
|
||||
return View("Create", new RdvQuery(activityCode, new Location(), DateTime.Now.AddHours(4))
|
||||
{
|
||||
PerformerProfile = pro,
|
||||
PerformerId = pro.PerformerId,
|
||||
ClientId = userid,
|
||||
Client = user,
|
||||
ActivityCode = activityCode
|
||||
});
|
||||
}
|
||||
|
||||
// POST: Command/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(RdvQuery command)
|
||||
{
|
||||
// TODO validate BillingCode value
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var prid = command.PerformerId;
|
||||
if (string.IsNullOrWhiteSpace(uid)
|
||||
|| string.IsNullOrWhiteSpace(prid))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs a PerformerId"
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.DeviceDeclaration)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
var user = await _userManager.FindByIdAsync(uid);
|
||||
command.Client = user;
|
||||
command.ClientId = uid;
|
||||
command.PerformerProfile = pro;
|
||||
// FIXME Why!!
|
||||
ModelState.MarkFieldSkipped("ClientId");
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var existingLocation = _context.Locations.FirstOrDefault(x => x.Address == command.Location.Address
|
||||
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude);
|
||||
|
||||
if (existingLocation != null)
|
||||
{
|
||||
command.Location = existingLocation;
|
||||
}
|
||||
else _context.Attach<Location>(command.Location);
|
||||
_context.RdvQueries.Add(command);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
var yaev = command.CreateEvent("NewCommand");
|
||||
|
||||
MessageWithPayloadResponse nrep = null;
|
||||
|
||||
if (pro.AcceptNotifications
|
||||
&& pro.AcceptPublicContact)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Notifying query");
|
||||
var uids = new[] { command.PerformerProfile.PerformerId };
|
||||
nrep = await _MessageSender.NotifyBookQueryAsync(uids, yaev);
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile
|
||||
// if (grep==null || grep.success<=0 || grep.failure>0)
|
||||
ViewBag.MessagingResponsePayload = nrep;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Message sending failed with: " + ex.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nrep = new MessageWithPayloadResponse
|
||||
{
|
||||
failure = 1,
|
||||
results = new MessageWithPayloadResponse.Result[] {
|
||||
new MessageWithPayloadResponse.Result
|
||||
{
|
||||
error=NotificationTypes.ContactRefused,
|
||||
registration_id= pro.PerformerId
|
||||
}
|
||||
}
|
||||
};
|
||||
_logger.LogInformation("Command.Create && ( !pro.AcceptNotifications || |pro.AcceptPublicContact ) ");
|
||||
}
|
||||
ViewBag.MessagingResponsePayload = nrep;
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View("CommandConfirmation", command);
|
||||
}
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View(command);
|
||||
}
|
||||
|
||||
// GET: Command/Edit/5
|
||||
public IActionResult Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
if (command == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(command);
|
||||
}
|
||||
|
||||
// POST: Command/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(RdvQuery command)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(command);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(command);
|
||||
}
|
||||
|
||||
// GET: Command/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public IActionResult Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
if (command == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(command);
|
||||
}
|
||||
|
||||
// POST: Command/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(long id)
|
||||
{
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
_context.RdvQueries.Remove(command);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
public IActionResult CGV()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
131
src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs
Normal file
131
src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Workflow;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class CommandFormsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CommandFormsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: CommandForms
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var applicationDbContext = _context.CommandForm.Include(c => c.Context);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: CommandForms/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||
if (commandForm == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(commandForm);
|
||||
}
|
||||
|
||||
// GET: CommandForms/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
SetViewBag();
|
||||
return View();
|
||||
}
|
||||
private void SetViewBag(CommandForm commandForm = null)
|
||||
{
|
||||
ViewBag.ActivityCode = new SelectList(_context.Activities, "Code", "Name", commandForm?.ActivityCode);
|
||||
ViewBag.ActionName = _context.CommandForm.Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Title, Selected = commandForm.Id == c.Id });
|
||||
}
|
||||
// POST: CommandForms/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(CommandForm commandForm)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.CommandForm.Add(commandForm);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
SetViewBag(commandForm);
|
||||
return View(commandForm);
|
||||
}
|
||||
|
||||
// GET: CommandForms/Edit/5
|
||||
public async Task<IActionResult> Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||
if (commandForm == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
SetViewBag(commandForm);
|
||||
return View(commandForm);
|
||||
}
|
||||
|
||||
// POST: CommandForms/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(CommandForm commandForm)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(commandForm);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
SetViewBag(commandForm);
|
||||
return View(commandForm);
|
||||
}
|
||||
|
||||
// GET: CommandForms/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||
if (commandForm == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(commandForm);
|
||||
}
|
||||
|
||||
// POST: CommandForms/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||
{
|
||||
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
|
||||
_context.CommandForm.Remove(commandForm);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
119
src/Yavsc.Org/Controllers/Contracting/DjSettingsController.cs
Normal file
119
src/Yavsc.Org/Controllers/Contracting/DjSettingsController.cs
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical.Profiles;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class DjSettingsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public DjSettingsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: DjSettings
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.DjSettings.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: DjSettings/Details/5
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||
if (djSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(djSettings);
|
||||
}
|
||||
|
||||
// GET: DjSettings/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: DjSettings/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(DjSettings djSettings)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.DjSettings.Add(djSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(djSettings);
|
||||
}
|
||||
|
||||
// GET: DjSettings/Edit/5
|
||||
public async Task<IActionResult> Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||
if (djSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(djSettings);
|
||||
}
|
||||
|
||||
// POST: DjSettings/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(DjSettings djSettings)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(djSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(djSettings);
|
||||
}
|
||||
|
||||
// GET: DjSettings/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||
if (djSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(djSettings);
|
||||
}
|
||||
|
||||
// POST: DjSettings/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
|
||||
_context.DjSettings.Remove(djSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
188
src/Yavsc.Org/Controllers/Contracting/DoController.cs
Normal file
188
src/Yavsc.Org/Controllers/Contracting/DoController.cs
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Models;
|
||||
using Models.Workflow;
|
||||
using Yavsc.ViewModels.Workflow;
|
||||
using Yavsc.Services;
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Authorize]
|
||||
public class DoController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext dbContext;
|
||||
readonly ILogger logger;
|
||||
readonly IBillingService billing;
|
||||
public DoController(
|
||||
ApplicationDbContext context,
|
||||
IBillingService billing,
|
||||
ILogger<DoController> logger)
|
||||
{
|
||||
dbContext = context;
|
||||
this.billing = billing;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
// GET: /Do/Index
|
||||
[HttpGet]
|
||||
public IActionResult Index(string id)
|
||||
{
|
||||
if (id == null)
|
||||
id = User.GetUserId();
|
||||
|
||||
var userActivities = dbContext.UserActivities.Include(u => u.Does)
|
||||
.Include(u => u.User).Where(u=> u.UserId == id)
|
||||
.OrderByDescending(u => u.Weight);
|
||||
return View(userActivities.ToList());
|
||||
}
|
||||
|
||||
// GET: Do/Details/5
|
||||
public async Task<IActionResult> Details(string id, string activityCode)
|
||||
{
|
||||
|
||||
if (id == null || activityCode == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
UserActivity userActivity = dbContext.UserActivities.Include(m=>m.Does)
|
||||
.Include(m=>m.User).Single(m => m.DoesCode == activityCode && m.UserId == id);
|
||||
if (userActivity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
bool hasConfigurableSettings = (userActivity.Does.SettingsClassName != null);
|
||||
var settings = await billing.GetPerformersSettingsAsync(activityCode, id);
|
||||
ViewBag.ProfileType = Config.ProfileTypes.Single(t=>t.FullName==userActivity.Does.SettingsClassName);
|
||||
|
||||
var gift = new UserActivityViewModel {
|
||||
Declaration = userActivity,
|
||||
Settings = settings,
|
||||
NeedsSettings = hasConfigurableSettings
|
||||
};
|
||||
return View (gift);
|
||||
}
|
||||
|
||||
// GET: Do/Create
|
||||
[ActionName("Create"),Authorize]
|
||||
public IActionResult Create(string userId)
|
||||
{
|
||||
if (userId==null)
|
||||
userId = User.GetUserId();
|
||||
var model = new UserActivity { UserId = userId };
|
||||
ViewBag.DoesCode = new SelectList(dbContext.Activities, "Code", "Name");
|
||||
//ViewData["UserId"] = userId;
|
||||
ViewBag.UserId = new SelectList(dbContext.Performers.Include(p=>p.Performer), "PerformerId", "Performer", userId);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// POST: Do/Create
|
||||
[HttpPost(),ActionName("Create"),Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(UserActivity userActivity)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInMsRole("Administrator"))
|
||||
if (uid != userActivity.UserId)
|
||||
ModelState.AddModelError("User","You're not admin.");
|
||||
if (userActivity.UserId == null) userActivity.UserId = uid;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
dbContext.UserActivities.Add(userActivity);
|
||||
dbContext.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewBag.DoesCode = new SelectList(dbContext.Activities, "Code", "Name", userActivity.DoesCode);
|
||||
ViewBag.UserId = new SelectList(dbContext.Performers.Include(p=>p.Performer), "PerformerId", "User", userActivity.UserId);
|
||||
return View(userActivity);
|
||||
}
|
||||
|
||||
// GET: Do/Edit/5
|
||||
[Authorize]
|
||||
public IActionResult Edit(string id, string activityCode)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
UserActivity userActivity = dbContext.UserActivities.Include(
|
||||
u=>u.Does
|
||||
).Include(
|
||||
u=>u.User
|
||||
).Single(m => m.DoesCode == activityCode && m.UserId == id);
|
||||
if (userActivity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
ViewData["DoesCode"] = new SelectList(dbContext.Activities, "Code", "Does", userActivity.DoesCode);
|
||||
ViewData["UserId"] = new SelectList(dbContext.Performers, "PerformerId", "User", userActivity.UserId);
|
||||
return View(userActivity);
|
||||
}
|
||||
|
||||
// POST: Do/Edit/5
|
||||
[HttpPost,Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(UserActivity userActivity)
|
||||
{
|
||||
if (!User.IsInMsRole("Administrator"))
|
||||
if (User.GetUserId() != userActivity.UserId)
|
||||
ModelState.AddModelError("User","You're not admin.");
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
dbContext.Update(userActivity);
|
||||
dbContext.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewData["DoesCode"] = new SelectList(dbContext.Activities, "Code", "Does", userActivity.DoesCode);
|
||||
ViewData["UserId"] = new SelectList(dbContext.Performers, "PerformerId", "User", userActivity.UserId);
|
||||
return View(userActivity);
|
||||
}
|
||||
|
||||
// GET: Do/Delete/5
|
||||
[ActionName("Delete"),Authorize]
|
||||
public IActionResult Delete(string id, string activityCode)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
UserActivity userActivity = dbContext.UserActivities.Single(m => m.UserId == id && m.DoesCode == activityCode);
|
||||
|
||||
if (userActivity == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
if (!User.IsInMsRole("Administrator"))
|
||||
if (User.GetUserId() != userActivity.UserId)
|
||||
ModelState.AddModelError("User","You're not admin.");
|
||||
return View(userActivity);
|
||||
}
|
||||
|
||||
// POST: Do/Delete/5
|
||||
[HttpPost, ActionName("Delete"),Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(UserActivity userActivity)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return new BadRequestObjectResult(ModelState);
|
||||
if (!User.IsInMsRole("Administrator"))
|
||||
if (User.GetUserId() != userActivity.UserId) {
|
||||
ModelState.AddModelError("User","You're not admin.");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
dbContext.UserActivities.Remove(userActivity);
|
||||
dbContext.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
208
src/Yavsc.Org/Controllers/Contracting/EstimateController.cs
Normal file
208
src/Yavsc.Org/Controllers/Contracting/EstimateController.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
using System.Net.Mime;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Models;
|
||||
using Models.Billing;
|
||||
using Models.Workflow;
|
||||
using ViewModels.Auth;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Authorize]
|
||||
public class EstimateController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly SiteSettings _site;
|
||||
readonly IAuthorizationService authorizationService;
|
||||
|
||||
public EstimateController(ApplicationDbContext context, IAuthorizationService authorizationService, IOptions<SiteSettings> siteSettings)
|
||||
{
|
||||
_context = context;
|
||||
_site = siteSettings.Value;
|
||||
this.authorizationService = authorizationService;
|
||||
}
|
||||
|
||||
// GET: Estimate
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
return View(_context.Estimates.Include(e=>e.Query)
|
||||
.Include(e=>e.Query.PerformerProfile)
|
||||
.Include(e=>e.Query.PerformerProfile.Performer)
|
||||
.Where(
|
||||
e=>e.OwnerId == uid || e.ClientId == uid
|
||||
).OrderByDescending(e=>e.ProviderValidationDate)
|
||||
.ToList());
|
||||
}
|
||||
|
||||
// GET: Estimate/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Estimate estimate = _context.Estimates
|
||||
.Include(e => e.Query)
|
||||
.Include(e => e.Query.PerformerProfile)
|
||||
.Include(e => e.Query.PerformerProfile.Performer)
|
||||
.Include(e=> e.Bill)
|
||||
.Where(
|
||||
e=>e.OwnerId == uid || e.ClientId == uid
|
||||
)
|
||||
.Single(m => m.Id == id);
|
||||
if (estimate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
if (authorizationService.AuthorizeAsync(User, estimate, new ReadPermission()).IsFaulted)
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
return View(estimate);
|
||||
}
|
||||
|
||||
|
||||
// GET: Estimate/Create
|
||||
[Authorize]
|
||||
public IActionResult Create()
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
IQueryable<RdvQuery> queries = _context.RdvQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid);
|
||||
//.Select(bq=>new SelectListItem{ Text = bq.Client.UserName, Value = bq.Client.Id });
|
||||
ViewBag.Clients = queries.Select(q=>q.Client).Distinct();
|
||||
ViewBag.Queries = queries;
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Estimate/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(Estimate estimate,
|
||||
ICollection<IFormFile> newGraphics,
|
||||
ICollection<IFormFile> newFiles
|
||||
)
|
||||
{
|
||||
estimate.OwnerId = User.GetUserId();
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Estimates
|
||||
.Add(estimate);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
var query = _context.RdvQueries.FirstOrDefault(
|
||||
q=>q.Id == estimate.CommandId
|
||||
);
|
||||
var perfomerProfile = _context.Performers
|
||||
.Include(
|
||||
perpr => perpr.Performer).FirstOrDefault(
|
||||
x=>x.PerformerId == query.PerformerId
|
||||
);
|
||||
var command = _context.RdvQueries.FirstOrDefault(
|
||||
cmd => cmd.Id == estimate.CommandId
|
||||
);
|
||||
|
||||
var billsdir = Path.Combine(
|
||||
_site.Bills,
|
||||
perfomerProfile.Performer.UserName
|
||||
);
|
||||
|
||||
foreach (var gr in newGraphics)
|
||||
{
|
||||
ContentDisposition contentDisposition = new ContentDisposition(gr.ContentDisposition);
|
||||
await gr.SaveAsAsync(
|
||||
Path.Combine(
|
||||
Path.Combine(billsdir, estimate.Id.ToString()),
|
||||
contentDisposition.FileName));
|
||||
}
|
||||
foreach (var formFile in newFiles)
|
||||
{
|
||||
ContentDisposition contentDisposition = new ContentDisposition(formFile.ContentDisposition);
|
||||
await formFile.SaveAsAsync(
|
||||
Path.Combine(
|
||||
Path.Combine(billsdir, estimate.Id.ToString()),
|
||||
contentDisposition.FileName));
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(estimate);
|
||||
}
|
||||
|
||||
|
||||
// GET: Estimate/Edit/5
|
||||
public IActionResult Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
Estimate estimate = _context.Estimates
|
||||
.Where(e=>e.OwnerId==uid||e.ClientId==uid).Single(m => m.Id == id);
|
||||
if (estimate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(estimate);
|
||||
}
|
||||
|
||||
// POST: Estimate/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(Estimate estimate)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimate.OwnerId!=uid&&estimate.ClientId!=uid
|
||||
) return NotFound();
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(estimate);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(estimate);
|
||||
}
|
||||
|
||||
// GET: Estimate/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public IActionResult Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
Estimate estimate = _context.Estimates
|
||||
.Where(e=>e.OwnerId==uid||e.ClientId==uid) .Single(m => m.Id == id);
|
||||
if (estimate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(estimate);
|
||||
}
|
||||
|
||||
// POST: Estimate/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(long id)
|
||||
{
|
||||
Estimate estimate = _context.Estimates.Single(m => m.Id == id);
|
||||
_context.Estimates.Remove(estimate);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using Yavsc.Controllers.Generic;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Workflow.Profiles;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class FormationSettingsController : SettingsController<FormationSettings>
|
||||
{
|
||||
|
||||
public FormationSettingsController(ApplicationDbContext context) : base(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
121
src/Yavsc.Org/Controllers/Contracting/FormsController.cs
Normal file
121
src/Yavsc.Org/Controllers/Contracting/FormsController.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Forms;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class FormsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public FormsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Forms
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.Form.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Forms/Details/5
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||
if (form == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(form);
|
||||
}
|
||||
|
||||
// GET: Forms/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Forms/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(Form form)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Form.Add(form);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(form);
|
||||
}
|
||||
|
||||
// GET: Forms/Edit/5
|
||||
public async Task<IActionResult> Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||
if (form == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(form);
|
||||
}
|
||||
|
||||
// POST: Forms/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(Form form)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(form);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(form);
|
||||
}
|
||||
|
||||
// GET: Forms/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||
if (form == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(form);
|
||||
}
|
||||
|
||||
// POST: Forms/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
Form form = await _context.Form.SingleAsync(m => m.Id == id);
|
||||
_context.Form.Remove(form);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
136
src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs
Normal file
136
src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Models;
|
||||
using ViewModels.FrontOffice;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Services;
|
||||
|
||||
public class FrontOfficeController : Controller
|
||||
{
|
||||
readonly ApplicationDbContext _context;
|
||||
readonly UserManager<ApplicationUser> _userManager;
|
||||
readonly ILogger _logger;
|
||||
readonly IStringLocalizer _SR;
|
||||
private readonly IBillingService _billing;
|
||||
|
||||
public FrontOfficeController(ApplicationDbContext context,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IBillingService billing,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStringLocalizer<FrontOfficeController> SR)
|
||||
{
|
||||
_context = context;
|
||||
_userManager = userManager;
|
||||
_logger = loggerFactory.CreateLogger<FrontOfficeController>();
|
||||
_SR = SR;
|
||||
_billing = billing;
|
||||
}
|
||||
public ActionResult Index()
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var now = DateTime.Now;
|
||||
|
||||
var model = new FrontOfficeIndexViewModel
|
||||
{
|
||||
EstimateToProduceCount = _context.RdvQueries.Where(c => c.PerformerId == uid && c.EventDate > now
|
||||
&& c.ValidationDate == null && !_context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null))).Count(),
|
||||
EstimateToSignAsProCount = _context.RdvQueries.Where(c => (c.PerformerId == uid && c.EventDate > now
|
||||
&& c.ValidationDate == null && _context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null)))).Count(),
|
||||
EstimateToSignAsCliCount = _context.Estimates.Where(e => e.ClientId == uid && e.ClientValidationDate == null).Count(),
|
||||
BillToSignAsProCount = 0,
|
||||
BillToSignAsCliCount = 0,
|
||||
NewPayementsCount = 0
|
||||
};
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult> Profiles(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
throw new NotImplementedException("No Activity code");
|
||||
}
|
||||
ViewBag.Activity = await _context.Activities.FirstOrDefaultAsync(a => a.Code == id);
|
||||
var result = await _context.ListPerformersAsync(_billing, id);
|
||||
return View(result);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task <ActionResult> HairCut(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
throw new NotImplementedException("No Activity code");
|
||||
}
|
||||
ViewBag.Activity = await _context.Activities.FirstOrDefaultAsync(a => a.Code == id);
|
||||
var result = await _context.ListPerformersAsync(_billing, id);
|
||||
return View(result);
|
||||
}
|
||||
|
||||
|
||||
[Produces("text/x-tex"), Authorize, Route("estimate-{id}.tex")]
|
||||
[HttpGet]
|
||||
public ViewResult EstimateTex(long id)
|
||||
{
|
||||
var estimate = _context.Estimates.Include(x => x.Query)
|
||||
.Include(x => x.Query.Client)
|
||||
.Include(x => x.Query.PerformerProfile)
|
||||
.Include(x => x.Query.PerformerProfile.OrganizationAddress)
|
||||
.Include(x => x.Query.PerformerProfile.Performer)
|
||||
.Include(e => e.Bill).FirstOrDefault(x => x.Id == id);
|
||||
Response.ContentType = "text/x-tex";
|
||||
return View("Estimate.tex", estimate);
|
||||
}
|
||||
|
||||
[Authorize, Route("Estimate-{id}.pdf")]
|
||||
[HttpGet]
|
||||
public IActionResult EstimatePdf(long id)
|
||||
{
|
||||
ViewBag.TempDir = Config.SiteSetup.TempDir;
|
||||
ViewBag.BillsDir = AbstractFileSystemHelpers.UserBillsDirName;
|
||||
var estimate = _context.Estimates.Include(x => x.Query)
|
||||
.Include(x => x.Query.Client)
|
||||
.Include(x => x.Query.PerformerProfile)
|
||||
.Include(x => x.Query.PerformerProfile.OrganizationAddress)
|
||||
.Include(x => x.Query.PerformerProfile.Performer)
|
||||
.Include(e => e.Bill).FirstOrDefault(x => x.Id == id);
|
||||
if (estimate == null)
|
||||
throw new Exception("No data");
|
||||
return View("Estimate.pdf", estimate);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public IActionResult EstimateProValidation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public IActionResult EstimateClientValidation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
[Authorize]
|
||||
public IActionResult BillValidation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
[Authorize]
|
||||
public IActionResult BillAcquitment()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical.Profiles;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class GeneralSettingsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public GeneralSettingsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: GeneralSettings
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.GeneralSettings.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: GeneralSettings/Details/5
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||
if (generalSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(generalSettings);
|
||||
}
|
||||
|
||||
// GET: GeneralSettings/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: GeneralSettings/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(GeneralSettings generalSettings)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.GeneralSettings.Add(generalSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(generalSettings);
|
||||
}
|
||||
|
||||
// GET: GeneralSettings/Edit/5
|
||||
public async Task<IActionResult> Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||
if (generalSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(generalSettings);
|
||||
}
|
||||
|
||||
// POST: GeneralSettings/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(GeneralSettings generalSettings)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(generalSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(generalSettings);
|
||||
}
|
||||
|
||||
// GET: GeneralSettings/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||
if (generalSettings == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(generalSettings);
|
||||
}
|
||||
|
||||
// POST: GeneralSettings/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
|
||||
_context.GeneralSettings.Remove(generalSettings);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Models;
|
||||
using Models.Musical;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
public class MusicalTendenciesController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public MusicalTendenciesController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: MusicalTendencies
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View(_context.MusicalTendency.ToList());
|
||||
}
|
||||
|
||||
// GET: MusicalTendencies/Details/5
|
||||
public IActionResult Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
if (musicalTendency == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(musicalTendency);
|
||||
}
|
||||
|
||||
// GET: MusicalTendencies/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: MusicalTendencies/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(MusicalTendency musicalTendency)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.MusicalTendency.Add(musicalTendency);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(musicalTendency);
|
||||
}
|
||||
|
||||
// GET: MusicalTendencies/Edit/5
|
||||
public IActionResult Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
if (musicalTendency == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(musicalTendency);
|
||||
}
|
||||
|
||||
// POST: MusicalTendencies/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(MusicalTendency musicalTendency)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(musicalTendency);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(musicalTendency);
|
||||
}
|
||||
|
||||
// GET: MusicalTendencies/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public IActionResult Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
if (musicalTendency == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(musicalTendency);
|
||||
}
|
||||
|
||||
// POST: MusicalTendencies/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(long id)
|
||||
{
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
_context.MusicalTendency.Remove(musicalTendency);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Authorize("AdministratorOnly")]
|
||||
public class SIRENExceptionsController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public SIRENExceptionsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: SIRENExceptions
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View(_context.ExceptionsSIREN.ToList());
|
||||
}
|
||||
|
||||
// GET: SIRENExceptions/Details/5
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
|
||||
if (exceptionSIREN == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(exceptionSIREN);
|
||||
}
|
||||
|
||||
// GET: SIRENExceptions/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: SIRENExceptions/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ExceptionSIREN exceptionSIREN)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.ExceptionsSIREN.Add(exceptionSIREN);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(exceptionSIREN);
|
||||
}
|
||||
|
||||
// GET: SIRENExceptions/Edit/5
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
|
||||
if (exceptionSIREN == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(exceptionSIREN);
|
||||
}
|
||||
|
||||
// POST: SIRENExceptions/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(ExceptionSIREN exceptionSIREN)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(exceptionSIREN);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(exceptionSIREN);
|
||||
}
|
||||
|
||||
// GET: SIRENExceptions/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
|
||||
if (exceptionSIREN == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(exceptionSIREN);
|
||||
}
|
||||
|
||||
// POST: SIRENExceptions/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
|
||||
_context.ExceptionsSIREN.Remove(exceptionSIREN);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue