|
|
@ -3,9 +3,13 @@ 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 Microsoft.Extensions.Logging;
|
|
|
|
using Yavsc.Models;
|
|
|
|
using Yavsc.Models;
|
|
|
|
using Yavsc.Server.Models.IT;
|
|
|
|
using Yavsc.Server.Models.IT;
|
|
|
|
using Microsoft.AspNet.Authorization;
|
|
|
|
using Microsoft.AspNet.Authorization;
|
|
|
|
|
|
|
|
using Yavsc.Server.Helpers;
|
|
|
|
|
|
|
|
using Yavsc.Models.Workflow;
|
|
|
|
|
|
|
|
using Yavsc.Models.Payment;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yavsc.Controllers
|
|
|
|
namespace Yavsc.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -13,10 +17,12 @@ namespace Yavsc.Controllers
|
|
|
|
public class ProjectController : Controller
|
|
|
|
public class ProjectController : Controller
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private ApplicationDbContext _context;
|
|
|
|
private ApplicationDbContext _context;
|
|
|
|
|
|
|
|
ILogger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public ProjectController(ApplicationDbContext context)
|
|
|
|
public ProjectController(ApplicationDbContext context, ILoggerFactory loggerFactory)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_context = context;
|
|
|
|
_context = context;
|
|
|
|
|
|
|
|
_logger = loggerFactory.CreateLogger<ProjectController>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GET: Project
|
|
|
|
// GET: Project
|
|
|
@ -46,11 +52,19 @@ namespace Yavsc.Controllers
|
|
|
|
// GET: Project/Create
|
|
|
|
// GET: Project/Create
|
|
|
|
public IActionResult Create()
|
|
|
|
public IActionResult Create()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ViewData["ClientId"] = new SelectList(_context.ApplicationUser, "Id", "Client");
|
|
|
|
|
|
|
|
ViewData["ActivityCode"] = new SelectList(_context.Activities, "Code", "Context");
|
|
|
|
ViewBag.ClientIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
|
|
|
|
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "PerformerProfile");
|
|
|
|
u => u.Id, u => u.UserName);
|
|
|
|
ViewData["PaymentId"] = new SelectList(_context.PayPalPayments, "CreationToken", "Regularisation");
|
|
|
|
ViewBag.OwnerIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
|
|
|
|
ViewData["Name"] = new SelectList(_context.GitRepositoryReference, "Path", "Repository");
|
|
|
|
u => u.Id, u => u.UserName);
|
|
|
|
|
|
|
|
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
|
|
|
|
|
|
|
a => a.Code, a => a.Name);
|
|
|
|
|
|
|
|
ViewBag.PerformerIdItems = _context.Performers.CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
|
|
|
|
|
|
|
|
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
|
|
|
|
|
|
|
|
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
|
|
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
return View();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -65,11 +79,19 @@ namespace Yavsc.Controllers
|
|
|
|
await _context.SaveChangesAsync();
|
|
|
|
await _context.SaveChangesAsync();
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ViewData["ClientId"] = new SelectList(_context.ApplicationUser, "Id", "Client", project.ClientId);
|
|
|
|
ViewBag.ClientIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
|
|
|
|
ViewData["ActivityCode"] = new SelectList(_context.Activities, "Code", "Context", project.ActivityCode);
|
|
|
|
u => u.Id, u => u.UserName);
|
|
|
|
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "PerformerProfile", project.PerformerId);
|
|
|
|
ViewBag.OwnerIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
|
|
|
|
ViewData["PaymentId"] = new SelectList(_context.PayPalPayments, "CreationToken", "Regularisation", project.PaymentId);
|
|
|
|
u => u.Id, u => u.UserName);
|
|
|
|
ViewData["Name"] = new SelectList(_context.GitRepositoryReference, "Path", "Repository", project.Name);
|
|
|
|
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
|
|
|
|
|
|
|
a => a.Code, a => a.Name);
|
|
|
|
|
|
|
|
ViewBag.PerformerIdItems = _context.Performers.CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
|
|
|
|
|
|
|
|
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
|
|
|
|
|
|
|
|
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return View(project);
|
|
|
|
return View(project);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|