public Task <bool> Handle(UpdateDesignerCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(Task.FromResult(false)); } var model = designerRepository.GetById(request.Id); if (model == null) { bus.RaiseEvent(new DomainNotification(request.MessageType, "This Designer not found.")); return(Task.FromResult(false)); } model.DescriptionEN = request.DescriptionEN; model.DescriptionPT = request.DescriptionPT; model.EntityState = request.EntityState; designerRepository.Update(model); if (Commit()) { bus.RaiseEvent(new DesignerUpdatedEvent(model.Id, model.DescriptionPT, model.DescriptionEN, model.EntityState, model.DateCreated)); } return(Task.FromResult(true)); }
public DesignerVM GetById(int id) { return(mapper.Map <DesignerVM>(designerRepository.GetById(id))); }