public virtual async Task <UpdateResponse <ApiVPersonServerResponseModel> > Update( int personId, ApiVPersonServerRequestModel model) { var validationResult = await this.VPersonModelValidator.ValidateUpdateAsync(personId, model); if (validationResult.IsValid) { VPerson record = this.DalVPersonMapper.MapModelToEntity(personId, model); await this.VPersonRepository.Update(record); record = await this.VPersonRepository.Get(personId); ApiVPersonServerResponseModel apiModel = this.DalVPersonMapper.MapEntityToModel(record); await this.mediator.Publish(new VPersonUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiVPersonServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiVPersonServerResponseModel> .UpdateResponse(validationResult)); } }
public virtual async Task <UpdateResponse <ApiSelfReferenceServerResponseModel> > Update( int id, ApiSelfReferenceServerRequestModel model) { var validationResult = await this.SelfReferenceModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { SelfReference record = this.DalSelfReferenceMapper.MapModelToEntity(id, model); await this.SelfReferenceRepository.Update(record); record = await this.SelfReferenceRepository.Get(id); ApiSelfReferenceServerResponseModel apiModel = this.DalSelfReferenceMapper.MapEntityToModel(record); await this.mediator.Publish(new SelfReferenceUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiSelfReferenceServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiSelfReferenceServerResponseModel> .UpdateResponse(validationResult)); } }