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