From 7e4a6172f0b2448c3305d6ed395a9d0257bb494b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 27 Dec 2018 23:53:27 +0000 Subject: [PATCH] refactoring --- Yavsc.Server/Models/IT/Evolution/Feature.cs | 5 +++-- Yavsc.Server/Models/IT/Evolution/FeatureStatus.cs | 4 ++-- Yavsc.Server/Models/IT/Fixing/Bug.cs | 5 ++++- Yavsc/Controllers/Survey/BugController.cs | 4 ++++ Yavsc/Controllers/Survey/FeatureController.cs | 2 +- Yavsc/Helpers/PageHelpers.cs | 8 +++++++- Yavsc/Models/ApplicationDbContext.cs | 2 +- Yavsc/Views/Bug/Create.cshtml | 14 +++++++++++--- 8 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Yavsc.Server/Models/IT/Evolution/Feature.cs b/Yavsc.Server/Models/IT/Evolution/Feature.cs index 28ec1bdb..08384e1d 100644 --- a/Yavsc.Server/Models/IT/Evolution/Feature.cs +++ b/Yavsc.Server/Models/IT/Evolution/Feature.cs @@ -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; } } -} \ No newline at end of file +} diff --git a/Yavsc.Server/Models/IT/Evolution/FeatureStatus.cs b/Yavsc.Server/Models/IT/Evolution/FeatureStatus.cs index a4ca8236..b23a9b6e 100644 --- a/Yavsc.Server/Models/IT/Evolution/FeatureStatus.cs +++ b/Yavsc.Server/Models/IT/Evolution/FeatureStatus.cs @@ -1,4 +1,4 @@ -namespace Yavsc.Models.IT.Maintaining +namespace Yavsc.Models.IT.Evolution { /// /// A Feature status @@ -15,4 +15,4 @@ namespace Yavsc.Models.IT.Maintaining Rejected, Implemented } -} \ No newline at end of file +} diff --git a/Yavsc.Server/Models/IT/Fixing/Bug.cs b/Yavsc.Server/Models/IT/Fixing/Bug.cs index 15fe7035..718dcd04 100644 --- a/Yavsc.Server/Models/IT/Fixing/Bug.cs +++ b/Yavsc.Server/Models/IT/Fixing/Bug.cs @@ -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; } diff --git a/Yavsc/Controllers/Survey/BugController.cs b/Yavsc/Controllers/Survey/BugController.cs index 1a7f4656..f05d0fbf 100644 --- a/Yavsc/Controllers/Survey/BugController.cs +++ b/Yavsc/Controllers/Survey/BugController.cs @@ -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(f=>f.Id.ToString(),f=>f.ShortName,null).AddNull("none"); return View(); } diff --git a/Yavsc/Controllers/Survey/FeatureController.cs b/Yavsc/Controllers/Survey/FeatureController.cs index 76a0377a..a8cbb2c7 100644 --- a/Yavsc/Controllers/Survey/FeatureController.cs +++ b/Yavsc/Controllers/Survey/FeatureController.cs @@ -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; diff --git a/Yavsc/Helpers/PageHelpers.cs b/Yavsc/Helpers/PageHelpers.cs index 0348e4ce..517a170c 100644 --- a/Yavsc/Helpers/PageHelpers.cs +++ b/Yavsc/Helpers/PageHelpers.cs @@ -25,6 +25,12 @@ namespace Yavsc.Server.Helpers } + public static List AddNull(this List selectList, string displayNull) + { + selectList.Add(new SelectListItem { Text = displayNull }); + return selectList; + } + public static List CreateSelectListItems (this IEnumerabledata, Func dataField, Func displayField = null, object selectedValue =null) where T : class @@ -43,4 +49,4 @@ namespace Yavsc.Server.Helpers } } -} \ No newline at end of file +} diff --git a/Yavsc/Models/ApplicationDbContext.cs b/Yavsc/Models/ApplicationDbContext.cs index 24764bc3..3bcee7bb 100644 --- a/Yavsc/Models/ApplicationDbContext.cs +++ b/Yavsc/Models/ApplicationDbContext.cs @@ -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; diff --git a/Yavsc/Views/Bug/Create.cshtml b/Yavsc/Views/Bug/Create.cshtml index 6fdfec44..d4ab9966 100644 --- a/Yavsc/Views/Bug/Create.cshtml +++ b/Yavsc/Views/Bug/Create.cshtml @@ -12,16 +12,24 @@
- +
- + + +
+
+
+ +
+ +