Пример #1
0
        public async Task <IActionResult> Create([Bind("LanternId,LanternName,LanternType")] Lanterns lanterns)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lanterns);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lanterns));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("LampId,LampName,LampPower,LampLife")] Lamp lamp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lamp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lamp));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("StreetId,StreetName")] Streets streets)
        {
            if (ModelState.IsValid)
            {
                _context.Add(streets);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(streets));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("SectionId,BeginAndEnd,SectionName,StreetId")] Sections sections)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sections);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StreetId"] = new SelectList(_context.Streets, "StreetId", "StreetId", sections.StreetId);
            return(View(sections));
        }
Пример #5
0
        public async Task <IActionResult> Create([Bind("StreetLightingId,CountLantern,Failure,LampId,LanternId,SectionId")] StreetLightings streetLightings)
        {
            if (ModelState.IsValid)
            {
                _context.Add(streetLightings);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LampId"]    = new SelectList(_context.Lamps, "LampId", "LampId", streetLightings.LampId);
            ViewData["LanternId"] = new SelectList(_context.Lanterns, "LanternId", "LanternId", streetLightings.LanternId);
            ViewData["SectionId"] = new SelectList(_context.Sections, "SectionId", "SectionId", streetLightings.SectionId);
            return(View(streetLightings));
        }