public ActionResult Create(OutOrderInputModel model) { if (this.ModelState.IsValid) { model.StartDate = DateTime.Now; model.AuthorId = User.Identity.GetUserId(); var newOutOrder = this.Mapper.Map<OutOrder>(model); this.OutOrdersServices.Create(newOutOrder); TempData["Success"] = GlobalConstants.OutOrderCreateNotify; return this.RedirectToAction("Index"); } return this.View(model); }
public ActionResult Create() { var newOrder = new OutOrderInputModel(); newOrder.Suppliers = this.SuppliersServices .GetAll() .Select(s => new SelectListItem() { Text = s.Name, Value = s.Id.ToString() }) .ToList(); return this.View(newOrder); }