public async Task <PropertyViewModel> UpdatePropertyAsync(int id, PropertyUpdateModel model, User theOperator) { var property = await _propertyDataService.UpdateAsync(id, x => Mapper.Map(model, x), true, theOperator); var toReturn = Mapper.Map <PropertyViewModel>(property); return(toReturn); }
public async Task <IResultModel> Update(PropertyUpdateModel model) { var entity = await _repository.GetAsync(model.Id); if (entity == null) { return(ResultModel.NotExists); } _mapper.Map(model, entity); if (await _repository.Exists(entity)) { return(ResultModel.Failed($"属性名称({entity.Name})已存在")); } var result = await _repository.UpdateAsync(entity); return(ResultModel.Result(result)); }
public Task <IResultModel> Update(PropertyUpdateModel model) { return(_service.Update(model)); }
public async Task <IHttpActionResult> Put(int id, PropertyUpdateModel model) { return(Ok(await _propertyService.UpdatePropertyAsync(id, model, this.GetOperator(_userService)))); }