public async Task <IActionResult> Edit(int id, [Bind("StoreId,Name,Phone,Email,Street,City,State,ZipCode")] StoreLoc storeLoc) { if (id != storeLoc.StoreId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(storeLoc); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreLocExists(storeLoc.StoreId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(storeLoc)); }
public async Task <IActionResult> Create([Bind("StoreId,Name,Phone,Email,Street,City,State,ZipCode")] StoreLoc storeLoc) { if (ModelState.IsValid) { _context.Add(storeLoc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(storeLoc)); }
/// <summary> /// Sets location's state to edited /// </summary> /// <param name="cust"></param> public void Edit(StoreLoc l) { context.Entry(l).State = EntityState.Modified; }
/// <summary> /// Adds a customer to database /// </summary> /// <param name="cust"></param> public void Add(StoreLoc l) { context.StoreLoc.Add(l); }