Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 6
0
 public void AddRecord(Lighting lightingRecord)
 {
     lightingContext.Lightings.Add(lightingRecord);
     lightingContext.SaveChangesAsync();
 }