public ActionResult Details(SalesViewModel temp) { var repo = new PurchaseRepoADO(); var suit = temp.MobileSuit; var sale = temp.Sale; sale.InventoryNumber = suit.InventoryNumber; sale.SerialNumber = suit.SerialNumber; sale.Type = suit.Type; sale.Price = suit.SalePrice; var user = AuthorizeUtilities.GetUserId(this); repo.Insert(sale, user); //model.MobileSuit = modelfirst; //if (User.Identity.IsAuthenticated) //{ // var user = User.Identity; // ViewBag.Name = user.Name; // ViewBag.displayMenu = "No"; // if (IsAdminUser()) // { // ViewBag.displayMenu = "Yes"; // } // if (Request.IsAuthenticated) // { // ViewBag.UserId = AuthorizeUtilities.GetUserId(this); // } // return View(model); //} //else //{ // ViewBag.Name = "Not Logged IN"; // return View(model); //} return(View(temp)); }
public ActionResult Details(int id) { var repo = new MobileSuitRepositoryADO(); var modelfirst = repo.GetDetails(id); var model = new SalesViewModel(); var statesrepo = new StateRepositoryADO(); model.States = new SelectList(statesrepo.GetAll(), "StateId", "Name"); var purchaseRepo = new PurchaseRepoADO(); model.Purchase = new SelectList(purchaseRepo.GetAll(), "TypeId", "Type"); model.MobileSuit = modelfirst; if (User.Identity.IsAuthenticated) { var user = User.Identity; ViewBag.Name = user.Name; ViewBag.displayMenu = "No"; if (IsAdminUser()) { ViewBag.displayMenu = "Yes"; } if (Request.IsAuthenticated) { ViewBag.UserId = AuthorizeUtilities.GetUserId(this); } return(View(model)); } else { ViewBag.Name = "Not Logged IN"; return(View(model)); } }