Пример #1
0
        public async Task <ActionResult <RationDay> > UpdateDay(RationDay day)
        {
            var updateCommand = new UpdateDayCommand(day);
            var response      = await _mediator.Send(updateCommand);

            return(Ok(response));
        }
Пример #2
0
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateDayCommand(
                id: id,
                dayofweek: (DateTime)body.dayOfWeek,
                active: (bool)body.active,
                reserved: (bool)body.reserved
                );

            var product = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, product));
        }
        public Day Update(UpdateDayCommand command)
        {
            var Day = _repository.Get(command.Id);

            Day.Update(command.DayOfWeek, command.Active, command.Reserved);
            _repository.Update(Day);

            if (Commit())
            {
                return(Day);
            }

            return(null);
        }