public async Task <CarWashShortEntity> AddCarWash(IOperation operation, int userId, CarWashFullEntity entity) { var invalidatedHours = ValidateCarWashWorkingHours(entity).ToList(); if (invalidatedHours.Any()) { throw new Exception(ExceptionMessage.IncorrectWorkingHoursData(invalidatedHours)); } return(await carWashStore.Add(operation, userId, entity)); }
public async Task <CarWashShortEntity> UpdateCarWash(IOperation operation, CarWashFullEntity entity) { if (!await carWashStore.IsExist(operation, entity.Id)) { throw new Exception(ExceptionMessage.CarWashIsNotExist); } var invalidatedHours = ValidateCarWashWorkingHours(entity).ToList(); if (invalidatedHours.Any()) { throw new Exception(ExceptionMessage.IncorrectWorkingHoursData(invalidatedHours)); } return(await carWashStore.Update(operation, entity)); }