Пример #1
0
 //
 // GET: /VesselSchedule/Create
 public ActionResult Create()
 {
     var viewModel = new 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.IsActive = true;
     return View(viewModel);
 }
Пример #2
0
 public ActionResult Create(VesselScheduleViewModel viewModel)
 {
     var req = viewModel.MapTo<SaveVesselScheduleRequest>();
     _vesselScheduleService.SaveVesselSchedule(req);
     return RedirectToAction("Index");
 }
Пример #3
0
 public ActionResult Edit(VesselScheduleViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var req = viewModel.MapTo<SaveVesselScheduleRequest>();
         var resp = _vesselScheduleService.SaveVesselSchedule(req);
         return Json(resp);
     }
     else
     {
         var errorList = (from item in ModelState
                          where item.Value.Errors.Any()
                          select item.Value.Errors[0].ErrorMessage).ToList();
         return Json(new { IsSuccess = false, Message = errorList });
     }
 }
Пример #4
0
 public ActionResult Manage(VesselScheduleViewModel viewModel)
 {
     var req = viewModel.MapTo<SaveVesselScheduleRequest>();
     if (viewModel.AsNew) {
         req.Id = 0;
     }
     _vesselScheduleService.SaveVesselSchedule(req);
     return RedirectToAction("Display", "Highlight");
 }
Пример #5
0
 //
 // GET: /VesselSchedule/Create
 public ActionResult Create()
 {
     var viewModel = new 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.OrderBy(x=>x.Name).Select(x => new SelectListItem { Text = x.Name, Value = x.id.ToString() }).ToList();
     viewModel.Vessels = _vesselService.GetVessels(new GetVesselsRequest
     {
         Skip = 0,
         Take = 100
     }).Vessels.OrderBy(x=>x.Name).Select(x => new SelectListItem { Text = x.Name, Value = x.id.ToString() }).ToList();
     viewModel.IsActive = true;
     return PartialView(viewModel);
 }