public IHttpActionResult Update(SessionUpdateCommand session) { var validator = session.Validation(); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(() => SessionAppService.Update(session))); }
public async Task <bool> UpdateAsync(SessionUpdateCommand command) { var session = await _repository.SingleOrDefaultAsync(x => x.ID == command.ID, tracking : false); Guard.Against(session, ErrorType.NotFound); session = _mapper.Map <Session>(command); _repository.Update(session); return(await CommitAsync() > 0); }
public bool Update(SessionUpdateCommand session) { var sessionDb = SessionRepository.GetById(session.Id); if (sessionDb == null) { throw new NotFoundException("Registro não encontrado!"); } var seatEdit = Mapper.Map(session, sessionDb); var movie = MovieRepository.GetById(session.MovieId); seatEdit.Movie = movie; seatEdit.SetDuration(); seatEdit.SetEndDate(); return(SessionRepository.Update(seatEdit)); }
public async Task <IActionResult> UpdateAsync(SessionUpdateCommand command) { return(Ok(await _sessionService.UpdateAsync(command))); }