refactoring
This commit is contained in:
@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Models.IT.Maintaining
|
||||
namespace Yavsc.Models.IT.Evolution
|
||||
{
|
||||
public class Feature
|
||||
{
|
||||
@ -14,6 +14,7 @@ namespace Yavsc.Models.IT.Maintaining
|
||||
|
||||
[YaStringLength(10*1024,MinLen=3)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public FeatureStatus Status { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Yavsc.Models.IT.Maintaining
|
||||
namespace Yavsc.Models.IT.Evolution
|
||||
{
|
||||
/// <summary>
|
||||
/// A Feature status
|
||||
|
@ -15,7 +15,10 @@ namespace Yavsc.Models.IT.Fixing
|
||||
|
||||
public long? FeatureId { get; set; }
|
||||
|
||||
[YaStringLength(2048)]
|
||||
[YaStringLength(1024)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[YaStringLength(4096)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public BugStatus Status { get; set; }
|
||||
|
@ -3,6 +3,9 @@ using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.IT.Fixing;
|
||||
using Yavsc.Models.IT.Evolution;
|
||||
using System.Linq;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -41,6 +44,7 @@ namespace Yavsc.Controllers
|
||||
// GET: Bug/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.FeaturesIds = _context.Feature.CreateSelectListItems<Feature>(f=>f.Id.ToString(),f=>f.ShortName,null).AddNull("none");
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ using Microsoft.Data.Entity;
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Models;
|
||||
using Models.IT.Maintaining;
|
||||
using Models.IT.Evolution;
|
||||
public class FeatureController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
@ -25,6 +25,12 @@ namespace Yavsc.Server.Helpers
|
||||
|
||||
}
|
||||
|
||||
public static List<SelectListItem> AddNull(this List<SelectListItem> selectList, string displayNull)
|
||||
{
|
||||
selectList.Add(new SelectListItem { Text = displayNull });
|
||||
return selectList;
|
||||
}
|
||||
|
||||
public static List<SelectListItem> CreateSelectListItems<T> (this IEnumerable<T>data,
|
||||
Func<T,string> dataField,
|
||||
Func<T,string> displayField = null, object selectedValue =null) where T : class
|
||||
|
@ -6,7 +6,7 @@ using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.Data.Entity;
|
||||
using System.Threading;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.Models.IT.Maintaining;
|
||||
using Yavsc.Models.IT.Evolution;
|
||||
using Yavsc.Models.IT.Fixing;
|
||||
using Yavsc.Server.Models.EMailing;
|
||||
using Yavsc.Server.Models.IT.SourceCode;
|
||||
|
@ -12,16 +12,24 @@
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="FeatureId" class="col-md-2 control-label"></label>
|
||||
<label asp-for="Description" class="col-md-2 control-label">@SR["Description"]</label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="FeatureId" class="form-control" />
|
||||
<textarea asp-for="Description" class="form-control" >
|
||||
</textarea>
|
||||
<span asp-validation-for="Description" class="text-danger" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="FeatureId" class="col-md-2 control-label">@SR["Feature"]</label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="FeatureId" asp-items="@ViewBag.FeatureIds" />
|
||||
<span asp-validation-for="FeatureId" 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="@typeof(Yavsc.Models.IT.Fixing.BugStatus).CreateSelectListItems(Model.Status).AddNull("Not set")"></select>
|
||||
<span asp-validation-for="Status" class="text-danger" />
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user