Beispiel #1
0
 public void AddLogisticsCenter(LogisticsCenterDTO lcenter)
 {
     Context.LogisticsCenters.Add(new LogisticsCenter
     {
         CityId      = lcenter.CityId,
         DateUpdated = DateTime.Now
     });
 }
Beispiel #2
0
 public async Task <IActionResult> Create([Bind("Id,CityId,DateUpdated")] LogisticsCenterDTO logisticsCenter)
 {
     if (ModelState.IsValid)
     {
         _dbAccess.AddLogisticsCenter(logisticsCenter);
         _dbAccess.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["CityId"] = new SelectList(_dbAccess.GetCities(), "Id", "Name", logisticsCenter.CityId);
     return(View(logisticsCenter));
 }