public Quotation GetQuotationWithOrderDetailsServiceApplicationUserWhereQuotationIdEqualsId(Guid QuotationId) { Quotation q = new Quotation(); q = _quotationRepository.FirstOrDefault(q => q.Id == QuotationId, includeProperties: "OrderDetails"); q.OrderDetails.Service = _serviceRepository.FirstOrDefault(s => s.serviceId == q.OrderDetails.ServiceId); q.OrderDetails.Service.ApplicationUser = _applicationUserRepository.FirstOrDefault(a => a.Id == q.OrderDetails.Service.UserId); return(q); }
public IActionResult Summary() { List <ShoppingCart> shoppingCartList = new List <ShoppingCart>(); if (HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WebConstant.SessionCart) != null && HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WebConstant.SessionCart).Count() > 0) { //session exsits shoppingCartList = HttpContext.Session.Get <List <ShoppingCart> >(WebConstant.SessionCart); } List <int> prodInCart = shoppingCartList.Select(i => i.ProductId).ToList(); IEnumerable <Product> prodList = _prodRepo.GetAll(u => prodInCart.Contains(u.Id)); var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); ApplicationUser applicationUser = _userRepo.FirstOrDefault(u => u.Id == claim.Value); ProductUserVM = new ProductUserVM() { ApplicationUser = applicationUser, }; foreach (var cartObj in shoppingCartList) { Product prodTemp = _prodRepo.FirstOrDefault(u => u.Id == cartObj.ProductId); prodTemp.Unit = cartObj.Unit; ProductUserVM.ProductList.Add(prodTemp); } return(View(ProductUserVM)); }
public IActionResult Summary() { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); //var userId = User.FindFirstValue(ClaimTypes.Name); List <ShoppingCart> shoppingCartList = new List <ShoppingCart>(); if (HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WC.SessionCart) != null && HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WC.SessionCart).Count() > 0) { //session exsits shoppingCartList = HttpContext.Session.Get <List <ShoppingCart> >(WC.SessionCart); } List <int> prodInCart = shoppingCartList.Select(i => i.ProductId).ToList(); IEnumerable <Product> prodList = _prodRepo.GetAll(u => prodInCart.Contains(u.Id)); ProductUserVM = new ProductUserVM() { ApplicationUser = _appUserRepo.FirstOrDefault(u => u.Id == claim.Value), ProductList = prodList.ToList() }; return(View(ProductUserVM)); }
public IActionResult Summary() { ApplicationUser applicationUser; if (User.IsInRole(WebConstants.AdminRole)) { if (HttpContext.Session.Get <int>(WebConstants.SessionInquiryId) != 0) { //Cart was loaded using an inquiry InquiryHeader inquiryHeader = _inqHRepo.FirstOrDefault(x => x.Id == HttpContext.Session.Get <int>(WebConstants.SessionInquiryId)); applicationUser = new ApplicationUser() { Email = inquiryHeader.Email, FullName = inquiryHeader.FullName, PhoneNumber = inquiryHeader.PhoneNumber }; } else { applicationUser = new ApplicationUser(); } var gateway = _brain.GetGateway(); var clientToken = gateway.ClientToken.Generate(); ViewBag.ClientToken = clientToken; } else { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); //var userId = User.FindFirstValue(ClaimTypes.Name); applicationUser = _userRepo.FirstOrDefault(x => x.Id == claim.Value); } List <ShoppingCart> shoppingCartList = new List <ShoppingCart>(); if (HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WebConstants.SessionCart) != null && HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WebConstants.SessionCart).Count() > 0) { //Session exists shoppingCartList = HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WebConstants.SessionCart).ToList(); } List <int> prodInCart = shoppingCartList.Select(i => i.ProductId).ToList(); IEnumerable <Product> prodList = _prodRepo.GetAll(x => prodInCart.Contains(x.Id)); ProductUserVM = new ProductUserVM() { ApplicationUser = applicationUser, }; foreach (var cartObj in shoppingCartList) { Product prodTemp = _prodRepo.FirstOrDefault(x => x.Id == cartObj.ProductId); prodTemp.TempSqFt = cartObj.SqFt; ProductUserVM.ProductList.Add(prodTemp); } return(View(ProductUserVM)); }
private void LoadService(string userId) { ServiceAndProviderVM = new ServiceAndProviderVM() { Services = (List <GrupoESIModels.Models.Service>)_serviceRepository.GetAll(c => c.ApplicationUser.Id == userId, includeProperties: "serviceType,ApplicationUser"), UserObj = _applicationUserRepository.FirstOrDefault(u => u.Id == userId) }; ServiceAndProviderVM.UserLocalId = userId; }
public IActionResult ContactUs() { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); //var userId = User.FindFirstValue(ClaimTypes.Name); ContactUsVM = new ContactUsVM(); if (claim != null) { ContactUsVM.ApplicationUser = _userRepo.FirstOrDefault(u => u.Id == claim.Value); } return(View(ContactUsVM)); }
public IActionResult Summary() { ApplicationUser applicationUser; if (User.IsInRole(WC.AdminRole)) { if (HttpContext.Session.Get <int>(WC.SessionInquiryId) != 0) { //Cart has been loaded using an inquiry InquiryHeader inquiryHeader = _inqHRepo.FirstOrDefault(u => u.Id == HttpContext.Session.Get <int>(WC.SessionInquiryId)); applicationUser = new ApplicationUser() { Email = inquiryHeader.Email, FullName = inquiryHeader.FullName, PhoneNumber = inquiryHeader.PhoneNumber }; } else { applicationUser = new ApplicationUser(); } //Payments logic: var gateway = _brain.GetGateway(); var clientTocken = gateway.ClientToken.Generate(); ViewBag.ClientToken = clientTocken; } else { //Findout ID of Login User var clamsIdentity = (ClaimsIdentity)User.Identity; var claim = clamsIdentity.FindFirst(ClaimTypes.NameIdentifier); // If user not Login (claim == null). ID will be in claim.Value //Anoter way to find UserID //var userId = User.FindFirstValue(ClaimTypes.Name); applicationUser = _userRepo.FirstOrDefault(u => u.Id == claim.Value); } //Get list of Products from Session "ShoppingCart" List <ShoppingCart> shoppingCartList = new List <ShoppingCart>(); if (HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WC.SessionCart) != null && HttpContext.Session.Get <IEnumerable <ShoppingCart> >(WC.SessionCart).Count() > 0) { //Session exists shoppingCartList = HttpContext.Session.Get <List <ShoppingCart> >(WC.SessionCart); } // Store all Id to new List List <int> prodInCart = shoppingCartList.Select(i => i.ProductId).ToList(); IEnumerable <Product> prodList = _prodRepo.GetAll(u => prodInCart.Contains(u.Id)); ProductUserVM = new ProductUserVM() { ApplicationUser = applicationUser //, //ProductList = prodList.ToList() }; foreach (var cartObj in shoppingCartList) { Product prodTemp = _prodRepo.FirstOrDefault(u => u.Id == cartObj.ProductId); prodTemp.TempSqFt = cartObj.SqFt; ProductUserVM.ProductList.Add(prodTemp); } return(View(ProductUserVM)); }