コード例 #1
0
ファイル: KSController.cs プロジェクト: ferenets/ACSWeb
        public async Task <IActionResult> Create([Bind("ID,Name,ShortCompShopName,LVUID,AOTypeID,Notes")] KS kS)
        {
            ViewData["AOTypeID"] = new SelectList(_context.AOTypes, "ID", "Name", kS.AOTypeID);

            //var aotype = await _context.AOTypes.SingleOrDefaultAsync(t => t.AOTableName == "KS"); //Ищем тип ОА, НЕ ИМЯ,а именно "тип"

            //if (aotype != null)
            //{
            //    ViewData["AOTypeID"] = aotype.ID;
            //    kS.AOType = aotype;

            //}
            //else
            //{
            //    ModelState.AddModelError(string.Empty, "Такий тип об'єкту автоматизації відсутній.");
            //    return View();
            //}
            //------------------------------------------------------------------------------
            ViewData["LVUID"] = new SelectList(_context.LVUs, "ID", "Name", kS.LVUID);



            if (ModelState.IsValid)
            {
                kS.CreationDate = DateTime.Now;

                _context.Add(kS);
                await _context.SaveChangesAsync();

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


            return(View(kS));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,Name,ShortName,ControllerName,AOTableName,Notes")] AOType aOType)
        {
            if (ModelState.IsValid)
            {
                aOType.CreationDate = DateTime.Now;

                _context.Add(aOType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(aOType));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,Name,Notes")] SAKType sAKType)
        {
            if (ModelState.IsValid)
            {
                sAKType.CreationDate = DateTime.Now;

                _context.Add(sAKType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sAKType));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("ID,Manufacturer,Name,Notes")] PLC pLC)
        {
            if (ModelState.IsValid)
            {
                pLC.CreationDate = DateTime.Now;

                _context.Add(pLC);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pLC));
        }
コード例 #5
0
ファイル: LVUController.cs プロジェクト: ferenets/ACSWeb
        public async Task <IActionResult> Create([Bind("ID,Name,UMGID,Notes")] LVU lVU)
        {
            if (ModelState.IsValid)
            {
                lVU.CreationDate = DateTime.Now;

                _context.Add(lVU);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UMGID"] = new SelectList(_context.UMGs, "ID", "Name", lVU.UMGID);
            return(View(lVU));
        }
コード例 #6
0
ファイル: UMGController.cs プロジェクト: ferenets/ACSWeb
        public async Task <IActionResult> Create([Bind("ID,Name,ShortName,City,Notes")] UMG uMG)
        {
            if (ModelState.IsValid)
            {
                uMG.CreationDate = DateTime.Now;
                //uMG.LastEditDate = 0;

                _context.Add(uMG);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(uMG));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("ID,KSID,PipelineID")] KSPipeline kSPipeline)
        {
            if (ModelState.IsValid)
            {
                kSPipeline.CreationDate = DateTime.Now;

                _context.Add(kSPipeline);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KSID"]       = new SelectList(_context.KSs, "ID", "Name", kSPipeline.KSID);
            ViewData["PipelineID"] = new SelectList(_context.Pipelines, "ID", "Name", kSPipeline.PipelineID);
            return(View(kSPipeline));
        }
コード例 #8
0
ファイル: SAKController.cs プロジェクト: ferenets/ACSWeb
        public async Task <IActionResult> Create(/*int AOID,*/ [Bind("ID,Name,PLCID,Manufacturer,Seller,CommisioningDate,AOTypeID,AOID,SAKTypeID,Notes")] SAK sAK)
        {
            if (ModelState.IsValid)
            {
                sAK.CreationDate = DateTime.Now;


                _context.Add(sAK);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AOTypeID"]  = new SelectList(_context.AOTypes, "ID", "Name", sAK.AOTypeID);
            ViewData["PLCID"]     = new SelectList(_context.PLCs, "ID", "Name", sAK.PLCID);
            ViewData["SAKTypeID"] = new SelectList(_context.SAKTypes, "ID", "Name", sAK.SAKTypeID);
            return(View(sAK));
        }
コード例 #9
0
ファイル: GPAController.cs プロジェクト: ferenets/ACSWeb
        public async Task <IActionResult> Create([Bind("ID,Name,Power,EngineType,EngineName,VCNName,StationNumber,KSID,AOTypeID,Notes")] GPA gPA)
        {
            ViewData["AOTypeID"] = new SelectList(_context.AOTypes, "ID", "Name", gPA.AOTypeID);

            ViewData["KSID"] = new SelectList(_context.KSs, "ID", "Name", gPA.KSID);

            //-------ЗАПИСЬ в БД
            if (ModelState.IsValid)
            {
                gPA.CreationDate = DateTime.Now;

                _context.Add(gPA);
                await _context.SaveChangesAsync();

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


            return(View(gPA));
        }