public void UpdateClientSubGroup(UpdateClientSubGroupViewModel model)
 {
     try
     {
         if (model != null && model.ClientSubGroupID > 0)
         {
             MasterClientSubGroup entity = new MasterClientSubGroup();
             db.MasterClientSubGroups.Single(s => s.ClientSubGroupID == model.ClientSubGroupID).ClientSubGroupID   = model.ClientSubGroupID;
             db.MasterClientSubGroups.Single(s => s.ClientSubGroupID == model.ClientSubGroupID).ClientSubGroupName = model.SubGroupName;
             db.MasterClientSubGroups.Single(s => s.ClientSubGroupID == model.ClientSubGroupID).ClientAbbRowID     = model.ClientAbbRowID;
             db.MasterClientSubGroups.Single(s => s.ClientSubGroupID == model.ClientSubGroupID).Status             = model.Status;
         }
         else
         {
             throw new Exception("Client Sub Group colud not be blank!");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public UpdateClientSubGroupViewModel GetClientSubGroupForUpdateById(short ClientSubGroupID)
 {
     try
     {
         UpdateClientSubGroupViewModel model = new UpdateClientSubGroupViewModel();
         var entity = db.MasterClientSubGroups.Find(ClientSubGroupID);
         if (entity != null)
         {
             model.ClientSubGroupID = entity.ClientSubGroupID;
             model.SubGroupName     = entity.ClientSubGroupName;
             model.ClientAbbRowID   = entity.ClientAbbRowID;
             model.Status           = entity.Status;
         }
         else
         {
             throw new Exception("Invalid Id ");
         }
         return(model);
     }
     catch (Exception)
     {
         throw;
     }
 }