public ActionResult Create(int?id) { var userName = System.Web.HttpContext.Current.User.Identity.Name; var user = _systemService.GetUserAndRole(0, userName); if (user == null) { return(RedirectToAction("Index", "Login")); } if (user.PriceR == 0) { return(RedirectToAction("Index", "Home")); } var item = new V3_Price_By_Id(); if (id.HasValue) { item = _service.GetByKeySp(id.Value, "1"); } var model = new PriceViewModel { Id = item.Id, StockId = item.Stock_Id, StockCode = item.Stock_Code, StockName = item.Stock_Name, Price = item.Price, CurrencyId = item.Currency_Id, SupplierId = item.Supplier_Id, StoreId = item.Store_Id, dStart = item.Start, dEnd = item.End, StockType = item.Stock_Type, Unit = item.Unit, PartNo = item.Part_No, RalNo = item.Ral_No, ColorName = item.Color, Timestamp = item.Timestamp, UserLogin = user, Stores = new SelectList(_systemService.StoreList(), "Id", "Name"), Suppliers = new SelectList(_systemService.SupplierList(), "bSupplierID", "vSupplierName"), Currencies = new SelectList(_systemService.CurrencyList(), "Id", "Name") }; return(View(model)); }