public void UpdateServiceType(int id, string description) { var existing = AccountTypeRepository.GetServiceType(id); if (null == existing) { throw new ArgumentException(string.Format("{0} is not a valid service type id", id)); } //TODO: validate description existing.Description = description; AccountTypeRepository.SaveServiceType(existing); }
public void AddServiceType(string description) { var existing = AccountTypeRepository.GetServiceTypes(); if (null != existing.Where(e => e.Description == description).FirstOrDefault()) { throw new InvalidOperationException(string.Format("{0} already exists as a service type", description)); } AccountTypeRepository.SaveServiceType(new ServiceType() { Description = description }); }