public async Task <IActionResult> Edit(int id, [Bind("StoresByRouteID,StoreID,StoreName,RouteID,RouteName,UserName,CreatedDate,Order,DaysOfWeek")] StoresByRoute storesByRoute) { LoadViewBag(); if (id != storesByRoute.StoresByRouteID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(storesByRoute); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoresByRouteExists(storesByRoute.StoresByRouteID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(storesByRoute)); }
public async Task <IActionResult> Create([Bind("StoresByRouteID,StoreID,StoreName,RouteID,RouteName,UserName,CreatedDate,Order,DaysOfWeek")] StoresByRoute storesByRoute) { if (ModelState.IsValid) { storesByRoute.CreatedDate = DateTime.Now; storesByRoute.UserName = User.Identity.Name; _context.Add(storesByRoute); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(storesByRoute)); }