public IActionResult CreateMetric([FromBody] Metric metric) { if (metric == null) { return(BadRequest()); } _md.Metric.Add(metric); _md.SaveChanges(); return(CreatedAtRoute("GetMetric", new { id = metric.Id }, metric)); }
public IActionResult CreateIdea([FromBody] IdeaMaster idea) { if (idea == null) { return(BadRequest()); } _md.IdeaMaster.Add(new IdeaMaster() { Id = idea.Id, Name = idea.Name, Owner = idea.Owner, Title = idea.Title, Description = idea.Description, IdeaTypeId = 0, RenewedBy = "", DelFlg = "N", DelBy = "", Notification = idea.Notification, Responsible = "icreate", ITUnit = "CBA", SubmittedBy = idea.SubmittedBy, Attached = idea.Attached, OwnerPhoneNumber = idea.OwnerPhoneNumber, IdeaStatus = IdeaStatusList.submitted, ForwardDate = idea.ForwardDate, CCAddress = idea.CCAddress, CommentReview = "", Country = "NG", State = "LAG", BatchNumber = _md.BatchHistory.OrderByDescending(t => t.BatchNumber).Select(i => i.BatchNumber).FirstOrDefault(), MetricScore = "4/4/", TotalScore = 0 }); _md.SaveChanges(); return(CreatedAtRoute("GetIdea", new { id = idea.Id }, idea)); }
public MetricController(ICreateContext context) { _md = context; if (_md.Metric.Count() == 0) { _md.Metric.Add(new Metric { Id = 1, Name = "Cost", Weight = 4 }); _md.Metric.Add(new Metric { Id = 2, Name = "Personnel", Weight = 5 }); _md.SaveChanges(); } }
public IdeaController(ICreateContext context) { _md = context; if (_md.IdeaMaster.Count() == 0) { _md.IdeaMaster.Add(new IdeaMaster { Id = 1, Name = "Test", MetricScore = "4/5/" }); _md.BatchHistory.Add(new BatchHistory { Id = 1, BatchNumber = 1 }); _md.SaveChanges(); } }