コード例 #1
0
        public JsonResult Create(GeneralCategoryCreateVM vmObj)
        {
            bool isSaved = false;

            if (ModelState.IsValid)
            {
                var var = vmObj;

                isSaved = _Manager.Save(var.GeneralCategory);
            }



            if (isSaved)
            {
                status  = true;
                message = "Succesfully Saved";
            }
            else
            {
                message = "Error! Please try again.";
            }

            return(new JsonResult {
                Data = new { status = status, message = message }
            });
        }
コード例 #2
0
        public ViewResult Create(GeneralcategoryCreateVM generalcategoryCreateVm)
        {
            var generalCategory = new GeneralcategoryCreateVM();

            generalCategory = generalcategoryCreateVm;
            if (ModelState.IsValid)
            {
                bool isSaved = generalCategoryManager.Save(generalCategory.GeneralCategory);

                if (isSaved)
                {
                    ViewBag.Message = "Saved Successfully!";
                }
            }

            return(View(generalCategory));
        }