Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }