public IActionResult Upsert(ProductUnits units) { JsonResult result = new JsonResult(new { }); if (units.UnitId == 0) { _unitOfWork.ProductUnits.Add(units); } else { _unitOfWork.ProductUnits.Update(units); } _unitOfWork.Save(); result.Value = new { Data = true }; return(result); }
public IActionResult Upsert(int?id = 0) { ProductUnits unit = new ProductUnits(); JsonResult result = new JsonResult(new { }); if (id == 0) { result.Value = new { Data = true, message = "Its Insert Call" }; return(result); } unit = _unitOfWork.ProductUnits.Get(id); if (unit == null) { result.Value = new { Data = "Not Found" }; return(result); } result.Value = new { Data = unit, message = "Its Update Call" }; return(result); }