public async Task <IActionResult> Edit(int id, [Bind("Id,SectionName,SectionShortCode")] LocationSection locationSection) { if (id != locationSection.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locationSection); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationSectionExists(locationSection.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(locationSection)); }
public LocationSection CreateLocationIndoorSection(LocationSection obj) { obj.ID = Guid.NewGuid(); obj.NameUrlPart = obj.Name.ToUrlFriendlyString(); return(new LocationSectionRepository().Create(obj)); }
public async Task <IActionResult> Create([Bind("Id,SectionName,SectionShortCode")] LocationSection locationSection) { if (ModelState.IsValid) { _context.Add(locationSection); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(locationSection)); }