public async Task <IHttpActionResult> Put([FromODataUri] int CustomerCategoryID, CustomerCategory item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (CustomerCategoryID == item.CustomerCategoryID) { return(BadRequest()); } item.ObjectState = ObjectState.Modified; _service.Update(item); try { await _unitOfWorkAsync.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(CustomerCategoryID)) { return(NotFound()); } throw; } return(Updated(item)); }
public JavaScriptResult Edit(CustomerCategoryViewModel customerCategoryVm) { try { _customerCategoryService.Update(Mapper.Map <CustomerCategory>(customerCategoryVm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/CustomerCategory"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }