public async Task <IActionResult> Put(int id, [FromBody] Tax tax) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tax.TaxID) { return(BadRequest()); } _taxService.Edit(tax); try { await _unitOfWork.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!await _taxService.ExistsAsync(id)) { return(NotFound()); } throw; } return(Ok(tax)); }
public JsonResult UpdateTax(TaxTypeModel taxmodel) { if (ModelState.IsValid) { _taxService.Edit(taxmodel); return(Json(true, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }