public ActionResult Create(AccountGroup category) { var result = category; if (ModelState.IsValid) { category.IsDefault = false; result = service.Save(category); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(AccountGroup category) { var result = category; if (ModelState.IsValid) { if (string.IsNullOrEmpty(category.AccountGroupName)) { return(Json("Please input a valid name", JsonRequestBehavior.AllowGet)); } if (category.GroupUnder < 0) { return(Json("Please select accounting Head", JsonRequestBehavior.AllowGet)); } category.IsDefault = false; result = service.Save(category); } return(Json(result, JsonRequestBehavior.AllowGet)); }