public void AddClientSubGroup(AddClientSubGroupViewModel model) { try { if (model != null) { MasterClientSubGroup entity = new MasterClientSubGroup(); entity.ClientAbbRowID = model.ClientAbbRowID; entity.ClientSubGroupName = model.SubGroupName; db.MasterClientSubGroups.Add(entity); } else { throw new Exception("Client Sub-Group could not be blank!"); } } catch (Exception) { throw; } }
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; } }