public ActionResult SaveGRN(GRN user) { int id = 0; StoreService service = new StoreService(); try { if (user.GRNId > 0) { id = service.UpdateGRN(user); return(Json(new { Status = true, Id = id, Message = "Record updated successfully" }, JsonRequestBehavior.AllowGet)); } else { id = service.AddGRN(user); return(Json(new { Status = true, Id = id, Message = "Record added successfully" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Status = false, Message = "Error Occured" }, JsonRequestBehavior.AllowGet)); } }