public override bool Update(AbstractUpdateCommand <Lounge> command) { if (GetSessions(command.Id).Where(x => x.End >= DateTime.Now).Any()) { throw new BusinessException(ErrorCodes.BadRequest, "Não é possível editar uma sala que possua sessões futuras vinculadas à ela."); } return(base.Update(command)); }
public virtual bool Update(AbstractUpdateCommand <T> command) { T previousEntity = GetById(command.Id); if (previousEntity != null) { _mapper.Map(command, previousEntity); previousEntity.Validate(); _repository.Update(previousEntity); } return(_repository.Save()); }