public ApiActionResult UpdateCommonValues(CommonValueUpdateModel model) { try { CommonValues obj = new CommonValues(); obj = _dbConfigContext.CommonValues.AsNoTracking().FirstOrDefault(x => x.Id == model.Id); if (obj != null) { obj.ValueDouble = model.ValueDouble; obj.ValueGroup = model.ValueGroup; obj.ValueInt = model.ValueInt; obj.ValueString = model.ValueString; obj.Text = model.Text; obj.OrderBy = model.OrderBy; var resUpdate = _dbConfigContext.CommonValues.Update(obj); int flag = _dbConfigContext.SaveChanges(); if (flag != 0) { return(ApiActionResult.Success()); } return(ApiActionResult.Failed("Updated failed")); } return(ApiActionResult.Failed("Can not updated because entity doest not existed!!")); } catch (Exception ex) { return(ApiActionResult.Failed(ex.Message)); } }
public async Task <object> UpdateCommonValues(CommonValueUpdateModel model) { try { var req = new BaseRequest <CommonValueUpdateModel>(model); var apiResult = await _aPIExcute.PostData <object, CommonValueUpdateModel>(commonValueUrl, HttpMethodEnum.PUT, req, Token); return(apiResult.IsSuccessStatusCode); } catch (Exception ex) { return(false); throw ex; } }
public IActionResult UpdateCommonValue([FromBody] CommonValueUpdateModel model) { try { var flag = _commonValueService.UpdateCommonValues(model); if (flag.Succeeded) { return(Ok(flag)); } return(BadRequest(flag.Errors[0].Description)); } catch (Exception ex) { return(BadRequest(ex.StackTrace.ToString())); } }