public StoreModel GetCurrentUserStoreAccess() { Users user = _userService.GetUserByUsernameApplicationName(HttpContext.Current.User.Identity.Name, ConfigManager.Exchange.ApplicationName); var model = new StoreModel(); model.Id = user.Stores.Select(x => x.Id).FirstOrDefault().ToString(); model.StoreName = user.Stores.Select(x => x.Name).FirstOrDefault(); model.StoreCode = user.Stores.Select(x => x.Code).FirstOrDefault(); return model; }
public ActionResult View(string id) { var invoice = new Invoice(); invoice = _invoiceService.GetDataById(new Guid(id)); var model = new BuyModel(); var store = new StoreModel(); var cashier = new Profiles(); var appraiser = new Profiles(); var customer = new Customer(); cashier = _profileService.GetProfileByUserId(invoice.Cashier.Id); appraiser = _profileService.GetProfileByUserId(invoice.Appraiser.Id); customer = _customerService.GetDataById(invoice.Customer.Id); model.StoreId = invoice.Store.Id.ToString(); model.StoreName = invoice.Store.Name; model.StoreAddress = invoice.Store.Address; model.StoreTelephoneNo = invoice.Store.TelephoneNo; model.InvoiceNo = invoice.InvoiceNo; model.Cashier = Base.GenerateFullName(cashier.FirstName, cashier.MiddleName, cashier.LastName); model.Appraiser = Base.GenerateFullName(appraiser.FirstName, appraiser.MiddleName, appraiser.LastName); model.Customer = Base.GenerateFullName(customer.FirstName, customer.MiddleName, customer.LastName); //summary model.SubTotal = invoice.SubTotal; model.TotalBonus = invoice.TotalBonus; model.GrandTotal = invoice.GrandTotal; //purchases model.Purchases = invoice.Purchases; //company model.CompanyName = ConfigManager.Exchange.CompanyName; TempData["Invoice"] = model; return View(model); }