public IActionResult Update(YachtTourCounterViewModel model) { var result = _yachtTourCounterServices.Update(model); if (result.IsSuccessStatusCode) { return(Ok(result)); } return(BadRequest()); }
public BaseResponse <bool> Update(YachtTourCounterViewModel createModel) { try { if (createModel == null) { return(BaseResponse <bool> .BadRequest()); } var entity = _db.YachtTourCounters.FirstOrDefault(x => x.YachtTourId.Equals(createModel.YachtTourId)); if (entity == null) { return(BaseResponse <bool> .BadRequest()); } entity.InjectFrom(createModel); _db.YachtTourCounters.Update(entity); _db.SaveChangesAsync().Wait(); return(BaseResponse <bool> .Success()); } catch (Exception ex) { return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }