control projects

vnext
Paul Schneider 6 years ago
parent bbb750c47a
commit e56547d25f
4 changed files with 52 additions and 102 deletions

@ -19,7 +19,7 @@ namespace Yavsc.Server.Models.IT
[Required]
public string ProjectName { get; set;}
[ForeignKey("ProjectName")]
[ForeignKey("Name")]
public virtual Project TargetProject { get; set; }
}
@ -33,8 +33,6 @@ namespace Yavsc.Server.Models.IT
public override long Id { get; set ; }
public string OwnerId { get; set; }
public string LocalRepo { get; set; }
/// <summary>
/// This field is something like a key,
/// since it is required non null,
@ -65,8 +63,6 @@ namespace Yavsc.Server.Models.IT
return bill;
}
public string Description { get; set; }
public override string GetDescription()

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

@ -14,35 +14,13 @@
<div class="form-group">
<label asp-for="ActivityCode" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="ActivityCode" class ="form-control"></select>
<select asp-for="ActivityCode" class ="form-control" asp-items="@ViewBag.ActivityCodeItems" ></select>
</div>
</div>
<div class="form-group">
<label asp-for="ClientId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="ClientId" class ="form-control"></select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Consent" />
<label asp-for="Consent"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="DateCreated" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="DateCreated" class="form-control" />
<span asp-validation-for="DateCreated" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="DateModified" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="DateModified" class="form-control" />
<span asp-validation-for="DateModified" class="text-danger" />
<select asp-for="ClientId" class ="form-control" asp-items="@ViewBag.ClientIdItems"></select>
</div>
</div>
<div class="form-group">
@ -52,36 +30,24 @@
<span asp-validation-for="Description" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="LocalRepo" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="LocalRepo" class="form-control" />
<span asp-validation-for="LocalRepo" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Name" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Name" class ="form-control"></select>
<input asp-for="Name" class ="form-control" aria-required="true" ></input>
</div>
</div>
<div class="form-group">
<label asp-for="OwnerId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="OwnerId" class="form-control" />
<select asp-for="OwnerId" asp-items="@ViewBag.OwnerIdItems" class="form-control" >
</select>
<span asp-validation-for="OwnerId" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="PaymentId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="PaymentId" class ="form-control"></select>
</div>
</div>
<div class="form-group">
<label asp-for="PerformerId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="PerformerId" class ="form-control"></select>
<select asp-for="PerformerId" class ="form-control" asp-items="@ViewBag.PerformerId"></select>
</div>
</div>
<div class="form-group">
@ -91,49 +57,13 @@
<span asp-validation-for="Previsional" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Rejected" />
<label asp-for="Rejected"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="RejectedAt" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="RejectedAt" class="form-control" />
<span asp-validation-for="RejectedAt" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Status" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Status" class="form-control"></select>
<select asp-for="Status" class="form-control" asp-items="@ViewBag.Status" ></select>
<span asp-validation-for="Status" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="UserCreated" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="UserCreated" class="form-control" />
<span asp-validation-for="UserCreated" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="UserModified" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="UserModified" class="form-control" />
<span asp-validation-for="UserModified" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="ValidationDate" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ValidationDate" class="form-control" />
<span asp-validation-for="ValidationDate" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Version" class="col-md-2 control-label"></label>
<div class="col-md-10">

@ -11,8 +11,10 @@
@using System.Security.Claims;
@using System.Web.Optimization;
@using Yavsc;
@using Yavsc.Helpers;
@using Yavsc.Server.Helpers;
@using Yavsc.Models;
@using Yavsc.Models.Access;
@using Yavsc.Models.Auth;

Loading…