public async Task <IActionResult> EditLineUp(LineUpViewModel model) { if (ModelState.IsValid) { var lineup = await _converterHelper.ToLineUpAsync(model, false); _context.LineUps.Update(lineup); await _context.SaveChangesAsync(); return(RedirectToAction($"LineUpList/{model.Terminal_id}")); } return(View(model)); }
public async Task <IActionResult> AddLineUp(int?id) { var terminal = await _context.Terminals.FindAsync(id); if (id == null || terminal == null) { return(NotFound()); } var model = new LineUpViewModel { Terminal_id = terminal.Id, }; return(View(model)); }
public async Task <LineUp> ToLineUpAsync(LineUpViewModel model, bool IsNew) { return(new LineUp { Id = IsNew ? 0 : model.Id, Vessel = model.Vessel, Agency = model.Agency, Cargo = model.Cargo, Cargo_Charterer = model.Cargo_Charterer, Eta = model.Eta.ToUniversalTime(), Etb = model.Etb.ToUniversalTime(), Etc = model.Etb.ToUniversalTime(), Etd = model.Etd.ToUniversalTime(), Laycan = model.Laycan, Pol_Pod = model.Pol_Pod, Quantity = model.Quantity, Shipper_Consignee = model.Shipper_Consignee, Status = model.Status, Terminal = await _dataContext.Terminals.FindAsync(model.Terminal_id) }); }