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