Example #1
0
 public IActionResult SaveLine(CriteriaAssignViewModel model)
 {
     if (ModelState.IsValid)
     {
         var item = new CriteriaLine
         {
             Id          = model.Line.Id,
             Title       = model.Line.Title,
             Description = model.Line.Description,
             Weight      = model.Line.Weight,
         };
         _Service.SaveLine(model.Line.HeaderId, item);
     }
     return(RedirectToAction("Assign", new { id = model.Line.HeaderId }));
 }
Example #2
0
        public void SaveLine(int headerId, CriteriaLine item)
        {
            var header = CriteriaHeaderById(headerId);

            if (item.Id == 0)
            {
                item.CriteriaHeader = header;
                _dbContext.Add(item);
            }
            else
            {
                item.CriteriaHeader          = header;
                _dbContext.Entry(item).State = EntityState.Modified;
            }
            _dbContext.SaveChanges();
        }