示例#1
0
文件: DBAccess.cs 项目: Miro1187/Log
 public void AddLogisticsCenter(LogisticsCenterDTO lcenter)
 {
     Context.LogisticsCenters.Add(new LogisticsCenter
     {
         CityId      = lcenter.CityId,
         DateUpdated = DateTime.Now
     });
 }
示例#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));
 }