Example #1
0
        public ActionResult Create(Input input)
        {
            if (ModelState.IsValid)
            {
                //input.OrderId = GetOrderId(input.OrderId, input.CustomerId);
                input.IsActive = true;
                input.Code     = GenerateCode.GetInputCode();

                UnitOfWork.InputRepository.Insert(input);
                UnitOfWork.Save();
                return(RedirectToAction("Index"));
            }
            ViewBag.CityId = new SelectList(UnitOfWork.CityRepository.Get(), "Id", "Title", input.CityId);
            List <SelectListItem> items = new SelectList(UnitOfWork.CustomerRepository.Get(), "Id", "FullName", input.CustomerId).ToList();

            items.Insert(0, (new SelectListItem {
                Text = "انتخاب کنید...", Value = "0"
            }));
            ViewBag.CustomerId = items;
            //ViewBag.CustomerId = new SelectList(UnitOfWork.CustomerRepository.Get(), "Id", "FullName", input.CustomerId);
            ViewBag.TransporterId = new SelectList(UnitOfWork.TransporterRepository.Get(), "Id", "Title", input.TransporterId);
            //ViewBag.OrderId = new SelectList(UnitOfWork.OrderRepository.Get(), "Id", "Code", input.OrderId);
            return(View(input));
        }