public ApiActionResult Update(CommonLanguaguesUpdateModel model) { try { CommonLanguages obj = new CommonLanguages(); obj = _dbConfigContext.CommonLanguages.AsNoTracking().FirstOrDefault(x => x.Id == model.Id); if (obj != null) { obj.LanguageCode = model.LanguageCode; obj.LanguageName = model.LanguageName; obj.Remarks = model.Remarks; obj.ResourceKey = model.ResourceKey; _dbConfigContext.CommonLanguages.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 IActionResult UpdateValues([FromBody] CommonLanguaguesUpdateModel model) { try { var res = _commonLanguagueService.Update(model); if (!res.Succeeded) { return(NoContent()); } return(Ok(res)); } catch (Exception ex) { return(BadRequest(ex.StackTrace.ToString())); } }