public void AddLogisticsCenter(LogisticsCenterDTO lcenter) { Context.LogisticsCenters.Add(new LogisticsCenter { CityId = lcenter.CityId, DateUpdated = DateTime.Now }); }
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)); }