public ActionResult Edit(int id) { var vesselSchedule = _vesselScheduleService.GetVesselSchedule(new GetVesselScheduleRequest { Id = id }); var viewModel = vesselSchedule.MapTo <VesselScheduleViewModel>(); viewModel.SalesTypes = _selectService.GetSelect(new GetSelectRequest { Name = "vessel-schedule-sales-types" }).Options .Select(x => new SelectListItem { Text = x.Text, Value = x.Value }).ToList(); viewModel.Buyers = _buyerService.GetBuyers(new GetBuyersRequest { Skip = 0, Take = 100 }).Buyers.Select(x => new SelectListItem { Text = x.Name, Value = x.id.ToString() }).ToList(); viewModel.Vessels = _vesselService.GetVessels(new GetVesselsRequest { Skip = 0, Take = 100 }).Vessels.Select(x => new SelectListItem { Text = x.Name, Value = x.id.ToString() }).ToList(); return(PartialView(viewModel)); }
// // GET: /VesselSchedule/Edit/5 public ActionResult Edit(int id) { var vesselSchedule = _vesselScheduleService.GetVesselSchedule(new GetVesselScheduleRequest { Id = id }); var viewModel = vesselSchedule.MapTo <VesselScheduleViewModel>(); viewModel.SalesTypes = _selectService.GetSelect(new GetSelectRequest { Name = "vessel-schedule-sales-types" }).Options .Select(x => new SelectListItem { Text = x.Text, Value = x.Value }).ToList(); return(View(viewModel)); }
// // GET: /NLS/Edit/5 public ActionResult Manage() { var viewModel = new NLSViewModel(); var id = string.IsNullOrEmpty(Request.QueryString["nlsId"]) ? 0 : int.Parse(Request.QueryString["nlsId"]); if (id != 0) { var nls = _nlsService.GetNLS(new GetNLSRequest { Id = id }); viewModel = nls.MapTo <NLSViewModel>(); } else { var vesselScheduleId = int.Parse(Request.QueryString["vsId"]); viewModel.VesselScheduleId = vesselScheduleId; viewModel.VesselName = _vesselScheduleService.GetVesselSchedule(new GetVesselScheduleRequest { Id = vesselScheduleId }).VesselName; } return(View(viewModel)); }