public void UpdateLaborType(int id, string description) { var existing = AccountTypeRepository.GetLaborType(id); if (null == existing) { throw new ArgumentException(string.Format("{0} is not a valid labor type id", id)); } //TODO: validate description existing.Description = description; AccountTypeRepository.SaveLaborType(existing); }
public void AddLaborType(string description) { var existing = AccountTypeRepository.GetLaborTypes(); if (null != existing.Where(e => e.Description == description).FirstOrDefault()) { throw new InvalidOperationException(string.Format("{0} already exists as a labor type", description)); } AccountTypeRepository.SaveLaborType(new LaborType() { Description = description }); }