コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        public ActionResult Entry(GeneralCategory generalCategory)
        {
            bool isSaved = _categoryManager.Add(generalCategory);

            return(View());
        }