public ActionResult Save(GeneralCatagory generalCatagory) { List <GeneralCatagory> generalCatagories = manager.GetAll(); ViewBag.GeneralCategoryList = generalCatagories; bool IsCodeExist = manager.isCodeExist(generalCatagory.Code); if (IsCodeExist) { ViewBag.message = "Code is already exist !"; } else { bool Save = manager.Add(generalCatagory); if (Save) { ViewBag.message = "Save succesfull"; } else { ViewBag.message = "Save failed"; } } return(View()); }
public ActionResult Create([Bind(Include = "GeneralCategoryID,GeneralCategoryName,GeneralCategoryCode")] GeneralCategory generalcategory) { if (ModelState.IsValid) { //db.GeneralCategories.Add(generalcategory); //db.SaveChanges(); _generalCategoryManager.Add(generalcategory); return(RedirectToAction("Index")); } return(View(generalcategory)); }
public ActionResult Entry(GeneralCategory generalCategory) { var isAdded = _manager.Add(generalCategory); if (isAdded) { ViewBag.SuccessMessage = "General Category Created Successfully"; } else { ViewBag.Error = "Failed to Save"; } return(RedirectToAction("Entry", "GeneralCategory")); }
public ActionResult Entry(GeneralCategory generalCategory) { bool isSaved = _categoryManager.Add(generalCategory); return(View()); }