public ActionResult Index() { var dsService = new DistributionCenterService(); var ds = dsService.GetAll(); return(View(ds)); }
public ActionResult Create() { var model = new User(); model.DistributionCentersSelected = new List <int>(); var dcService = new DistributionCenterService(); var dcs = dcService.GetAll(); IList <SelectListItem> listItems = dcs.Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Code + " - " + x.Name }).ToList(); model.DistributionCentersSelect = new SelectList(listItems, "Value", "Text", String.Empty); return(View(model)); }
public ActionResult Edit(int?Id) { var userService = new UserService(); User user = userService.Get(Id); var dcService = new DistributionCenterService(); var dcs = dcService.GetAll(); IList <SelectListItem> listItems = dcs.Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Code + " - " + x.Name }).ToList(); user.DistributionCentersSelect = new SelectList(listItems, "Value", "Text", String.Empty); return(View(user)); }
public ActionResult Create(User model) { var userService = new UserService(); userService.Create(model); var dcService = new DistributionCenterService(); var dcs = dcService.GetAll(); IList <SelectListItem> listItems = dcs.Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Code + " - " + x.Name }).ToList(); model.DistributionCentersSelect = new SelectList(listItems, "Value", "Text", String.Empty); return(RedirectToAction("Index")); }