public async Task <ActionResult> Create(int?store_id, int?modelId, int?PhoneId)
        {
            ViewBag.Stores    = util.GetAllStores();
            ViewBag.Companies = util.GetAllCompany();
            if (store_id != null)
            {
                PurchasingViewModel p = new PurchasingViewModel();
                if (modelId != null && PhoneId != null)
                {
                    p.modelId = (int)modelId;
                    p.Phoneid = (int)PhoneId;
                }
                p.store_id = (int)store_id;
                return(View(p));
            }
            else
            {
                var user = await userManager.GetUserAsync(User);

                if (user.store_id != null)
                {
                    PurchasingViewModel p = new PurchasingViewModel();
                    p.store_id = (int)user.store_id;
                    return(View(p));
                }
            }

            return(View());
        }
        // GET: ComapnyModel/Create
        public ActionResult Create(int?PhoneId)
        {
            var Companies = util.GetAllCompany();

            if (!String.IsNullOrEmpty(PhoneId.ToString()))
            {
                ModelViewModel data = new ModelViewModel()
                {
                    PhoneId = Companies.FirstOrDefault(x => x.Phoneid == PhoneId).Phoneid
                };
                ViewBag.Companies = Companies;
                return(View(data));
            }
            ViewBag.Companies = Companies;
            return(View());
        }
Ejemplo n.º 3
0
 public IActionResult AddStockManually()
 {
     ViewBag.Companies = util.GetAllCompany();
     ViewBag.Stores    = util.GetAllStores();
     return(View());
 }
Ejemplo n.º 4
0
        // GET: Order/Create
        public async Task <ActionResult> Create(int?Phoneid, int?ModelId)
        {
            var user = await userManager.GetUserAsync(User);

            var Companies = util.GetAllCompany();

            ViewBag.Stores = util.GetAllStores();
            OrderViewModel data = new OrderViewModel();

            if (!(User.IsInRole("Admin") || User.IsInRole("Super Admin") || User.IsInRole("Employee")))
            {
                ViewBag.cities = util.getCities();
                data.cus_name  = user.FullName;
                data.cus_phone = user.PhoneNumber;
                data.CityId    = user.City;
                data.Address   = new Data.Model.Customer.Address()
                {
                    StreetAddress = user.StreetAdress
                };
                // data.Address.StreetAddress = user.StreetAdress;
                if (user.CusRef != null)
                {
                    data.CustRef = (int)user.CusRef;
                }
                else
                {
                    data.CustRef = util.GenerateCusRef();
                }
            }
            else
            {
                data.CustRef = util.GenerateCusRef();
                if (user.store_id != null)
                {
                    data.store_id = (int)user.store_id;
                }
            }
            if (ModelId != null)
            {
                //data.Phoneid = Companies.FirstOrDefault(x => x.Phoneid == Phoneid).Phoneid;
                // data.modelId = (int)ModelId;
            }
            ViewBag.Companies = Companies;
            return(View(data));
        }