コード例 #1
0
        public IActionResult Create()
        {
            FactoryService fs = new FactoryService(_con);

            ViewBag.Business = fs.GetallBusinessType();
            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> Create(FactoryDataModel obj)
        {
            FactoryService fs = new FactoryService(_con);
            var            y  = fs.GetFactoryByName(obj.Name);

            if (y != null)
            {
                ViewBag.Business = fs.GetallBusinessType();
                ModelState.AddModelError("Name", "Name is already exist");
                return(View(obj));
            }
            bool x = await fs.CreateFactory(obj);

            return(RedirectToAction(nameof(Index)));
        }