refactoring
This commit is contained in:
parent
f950f93f90
commit
18d1b7fea4
8 changed files with 33 additions and 11 deletions
|
|
@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Yavsc.Attributes.Validation;
|
using Yavsc.Attributes.Validation;
|
||||||
|
|
||||||
namespace Yavsc.Models.IT.Maintaining
|
namespace Yavsc.Models.IT.Evolution
|
||||||
{
|
{
|
||||||
public class Feature
|
public class Feature
|
||||||
{
|
{
|
||||||
|
|
@ -14,6 +14,7 @@ namespace Yavsc.Models.IT.Maintaining
|
||||||
|
|
||||||
[YaStringLength(10*1024,MinLen=3)]
|
[YaStringLength(10*1024,MinLen=3)]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public FeatureStatus Status { get; set; }
|
public FeatureStatus Status { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Yavsc.Models.IT.Maintaining
|
namespace Yavsc.Models.IT.Evolution
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Feature status
|
/// A Feature status
|
||||||
|
|
@ -15,4 +15,4 @@ namespace Yavsc.Models.IT.Maintaining
|
||||||
Rejected,
|
Rejected,
|
||||||
Implemented
|
Implemented
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ namespace Yavsc.Models.IT.Fixing
|
||||||
|
|
||||||
public long? FeatureId { get; set; }
|
public long? FeatureId { get; set; }
|
||||||
|
|
||||||
[YaStringLength(2048)]
|
[YaStringLength(1024)]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[YaStringLength(4096)]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public BugStatus Status { get; set; }
|
public BugStatus Status { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.IT.Fixing;
|
using Yavsc.Models.IT.Fixing;
|
||||||
|
using Yavsc.Models.IT.Evolution;
|
||||||
|
using System.Linq;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -41,6 +44,7 @@ namespace Yavsc.Controllers
|
||||||
// GET: Bug/Create
|
// GET: Bug/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
|
ViewBag.FeaturesIds = _context.Feature.CreateSelectListItems<Feature>(f=>f.Id.ToString(),f=>f.ShortName,null).AddNull("none");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using Microsoft.Data.Entity;
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
using Models;
|
using Models;
|
||||||
using Models.IT.Maintaining;
|
using Models.IT.Evolution;
|
||||||
public class FeatureController : Controller
|
public class FeatureController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
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,
|
public static List<SelectListItem> CreateSelectListItems<T> (this IEnumerable<T>data,
|
||||||
Func<T,string> dataField,
|
Func<T,string> dataField,
|
||||||
Func<T,string> displayField = null, object selectedValue =null) where T : class
|
Func<T,string> displayField = null, object selectedValue =null) where T : class
|
||||||
|
|
@ -43,4 +49,4 @@ namespace Yavsc.Server.Helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
using Yavsc.Models.IT.Maintaining;
|
using Yavsc.Models.IT.Evolution;
|
||||||
using Yavsc.Models.IT.Fixing;
|
using Yavsc.Models.IT.Fixing;
|
||||||
using Yavsc.Server.Models.EMailing;
|
using Yavsc.Server.Models.EMailing;
|
||||||
using Yavsc.Server.Models.IT.SourceCode;
|
using Yavsc.Server.Models.IT.SourceCode;
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,24 @@
|
||||||
<hr />
|
<hr />
|
||||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||||
<div class="form-group">
|
<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">
|
<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" />
|
<span asp-validation-for="FeatureId" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Status" class="col-md-2 control-label"></label>
|
<label asp-for="Status" class="col-md-2 control-label"></label>
|
||||||
<div class="col-md-10">
|
<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" />
|
<span asp-validation-for="Status" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue