public UpdateSeverityGridViewModel GetSeverityGridForUpdateById(short SeverityGridId)
 {
     try
     {
         UpdateSeverityGridViewModel model = new UpdateSeverityGridViewModel();
         var entity = db.MasterSeverityGrids.Find(SeverityGridId);
         if (entity != null)
         {
             model.SeverityGridRowId = entity.SeverityGridRowId;
             model.SeverityGrid      = entity.SeverityGrid;
             model.ColorName         = entity.ColorName;
             model.ColorCode         = entity.ColorCode;
             model.Status            = entity.Status;
         }
         else
         {
             throw new Exception("Invalid Id!");
         }
         return(model);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void UpdateSeverityGrid(UpdateSeverityGridViewModel model)
 {
     try
     {
         if (model != null & model.SeverityGridRowId > 0)
         {
             db.MasterSeverityGrids.Single(s => s.SeverityGridRowId == model.SeverityGridRowId).SeverityGridRowId = model.SeverityGridRowId;
             db.MasterSeverityGrids.Single(s => s.SeverityGridRowId == model.SeverityGridRowId).SeverityGrid      = model.SeverityGrid;
             db.MasterSeverityGrids.Single(s => s.SeverityGridRowId == model.SeverityGridRowId).ColorName         = model.ColorName;
             db.MasterSeverityGrids.Single(s => s.SeverityGridRowId == model.SeverityGridRowId).ColorCode         = model.ColorCode;
             db.MasterSeverityGrids.Single(s => s.SeverityGridRowId == model.SeverityGridRowId).Status            = model.Status;
         }
         else
         {
             throw new Exception("Severity Grid could not be blank!");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }