public IActionResult Match(AdminOrderViewModel orderVm) { if (orderVm.MatchVm.AccountNo == null || orderVm.MatchVm.TransactionId == null) { return(RedirectToAction("ConfirmOrder", new { id = orderVm.Order.Id })); } if (orderVm.MatchVm.AccountNo == null && orderVm.MatchVm.TransactionId == null) { return(RedirectToAction("ConfirmOrder", new { id = orderVm.Order.Id })); } var order = _context.Orders.Find(orderVm.Order.Id); if (order.AccountNo == orderVm.MatchVm.AccountNo && order.TransactionId == orderVm.MatchVm.TransactionId) { ViewBag.confirm = "Matched !"; } var vm = new OrderViewModel { Order = _context.Orders.Find(orderVm.Order.Id) }; return(View("ConfirmOrder", vm)); }
public async Task <ActionResult> AdminOrders(AdminOrderViewModel model) { model.LoggedInUser = await userService.GetCurrentUser(); model.FullNavList = CreateUserControllerAdminNavList(); if (model.SelectedPage != 0) { model.CurrentPage = model.SelectedPage; } model.TotalItems = userService.GetOrders().Count(); if (model.LoggedInUser.PaginationPreference != 0) { model.UserPaginationPreference = model.LoggedInUser.PaginationPreference; model.Orders = userService.GetOrders().OrderByDescending(p => p.SaleDate).Skip((model.CurrentPage - 1) * model.LoggedInUser.PaginationPreference).Take(model.UserPaginationPreference).ToList(); } else { model.Orders = userService.GetOrders().OrderByDescending(p => p.SaleDate).ToList(); } return(View(model)); }
public async Task<IActionResult> Index() { List<Order> orders = await _db.Order.ToListAsync(); List<AdminOrderViewModel> orderVm = new List<AdminOrderViewModel>(); if(orders==null || orders.Count() < 1) { return View(null); } for(int i = 0; i < orders.Count(); i++) { AdminOrderViewModel orVm = new AdminOrderViewModel(); orVm.order = orders[i]; List<CartModel> list = new List<CartModel>(); list = SerializeObject.DeSerializeObjectFromString<List<CartModel>>(orders[i].Products,list); List<Book> books = new List<Book>(); List<string> count = new List<string>(); for(int j = 0; j < list.Count(); j++) { books.Add(await _db.Book.FindAsync(list[j].productId)); count.Add(list[j].count); } orVm.books = books; orVm.count = count; orderVm.Add(orVm); } return View(orderVm); }
public ViewResult GetUserOrders(int id) { var orders = _context.Orders.Include(o => o.Customer).Include(o => o.Product).Where(o => o.Customer.Id == id).ToList(); AdminOrderViewModel viewmodel = new AdminOrderViewModel(); viewmodel.Orders = orders; return(View(viewmodel)); }
public IActionResult ConfirmOrder(long id) { var vm = new AdminOrderViewModel { Order = _context.Orders.Find(id), }; return(View(vm)); }
public ActionResult UpdateOrder(string id) { viewModel = new AdminOrderViewModel(); Order order = orderContext.Find(id); //order.orderItems = orderItemContext.DisplayAll().Where(item => item.orderId == order.ID).ToList(); viewModel.Order = order; viewModel.Status = orderStatus.DisplayAll(); return(View(viewModel)); }
public IActionResult Order(int id) { var model = new AdminOrderViewModel { Order = _NorthwindDAL.GetOrder(id), OrderDetails = _NorthwindDAL.GetOrderDetails(id) }; return(View(model)); }
public ViewResult GetOrderSummary(int orderNumber) { var orders = _context.Orders.Include(o => o.Product).Where(o => o.OrderNumber == orderNumber).ToList(); AdminOrderViewModel viewmodel = new AdminOrderViewModel(); float total = 0.0f; if (orders.Count > 0) { foreach (var order in orders) { total += order.SubTotal; } } viewmodel.Orders = orders; viewmodel.Total = total; return(View(viewmodel)); }
public IActionResult Index() { var orders = _context.Orders.Include(o => o.Customer).AsNoTracking(); var products = _context.Products .Include(p => p.District) .Include(p => p.Category) .Include(p => p.Seller).AsNoTracking() .ToList(); var productOrder = _context.ProductOrders.AsNoTracking().ToList(); var vm = new AdminOrderViewModel { Products = products, Orders = orders, ProductOrders = productOrder, AgentOrders = _context.AgentOrders.ToList() }; return(View(vm)); }
public ActionResult EditStatus(AdminOrderViewModel order) { if (AuthorizationHelper.GetUserInfo() is null) { return(RedirectToAction("Login", "Account")); } using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44358/"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Session["accessToken"].ToString()); var orderResponse = client.PutAsJsonAsync("api/Order/EditStatus", order).Result; if (orderResponse.IsSuccessStatusCode) { return(RedirectToAction("AdminDashBoard")); } return(RedirectToAction("Error", "Home")); } }
public ActionResult Index2(int?page_id, int?page_size, int?filterCurrencyId, int?status, int?paymentStatus, PagerParameters pagerParameters) { var orders = _orderService.GetAllOrders() .Where(item => item.IsActive && item.Email != null && item.Products.Count > 0); if (status.HasValue) { orders = orders.Where(aa => aa.OrderStatusRecord.Id == status.Value); } if (filterCurrencyId.HasValue) { var filterCurrency = _currencyRepository.Get(filterCurrencyId.Value); orders = orders.Where(o => o.CurrencyRecord == filterCurrency); } if (paymentStatus.HasValue) { if (paymentStatus.Value != -1) { orders = orders.Where(aa => ((paymentStatus.Value == 0) ? aa.ProfitPaid : !aa.ProfitPaid)); } } var orderEntities = new AdminOrderViewModel(); foreach (var item in orders) { CampaignProductRecord campRec = null; campRec = item.Products.First().CampaignProductRecord; //if (item.Products == null || item.Products.Count() == 0 || ()== null) continue; var campaignId = campRec.CampaignRecord_Id; if (campaignId == null) { continue; } var campaign = _campaignService.GetCampaignById(campaignId); try { var seller = _contentManager.Query <UserPart, UserPartRecord>() .Where(user => user.Id == campaign.TeeyootUserId) .List() .First(); double orderProfit = 0; foreach (var product in item.Products) { var prof = product.CampaignProductRecord.Price - product.CampaignProductRecord.BaseCost; foreach (var size in product.CampaignProductRecord.ProductRecord.SizesAvailable) { if (size.Id == product.ProductSizeRecord.Id) { prof = prof - size.SizeCost; } } orderProfit = orderProfit + (prof * product.Count); orderProfit = Math.Round(orderProfit, 2); } //if (string.IsNullOrWhiteSpace(searchString) || campaign.Title.ToLower().Contains(searchString.ToLower())) //{ orderEntities.Orders.Add(new AdminOrder { PublicId = item.OrderPublicId, Products = item.Products, Status = item.OrderStatusRecord.Name, EmailBuyer = item.Email, CampaignId = campaign.Id, CampaignName = campaign.Title, CampaignAlias = campaign.Alias, Id = item.Id, Profit = orderProfit, SellerId = seller != null ? seller.Id : 0, Payout = item.ProfitPaid, CreateDate = item.Created, UserNameSeller = seller != null ? seller.UserName : "", Currency = item.CurrencyRecord.ShortName }); //} } catch (Exception ex) { Logger.Error(ex, campaign.TeeyootUserId + " ERROOORRRRRRRRRRRR "); throw; } } //var qwe = new List<SelectListItem>(); //var entriesProjection = orderEntities.Orders.Select(e => //{ // return Shape.FaqEntry( // PublicId: e.PublicId, // Products: e.Products, // Status: e.Status, // EmailBuyer: e.EmailBuyer, // Id: e.Id, // Profit: e.Profit, // UserNameSeller: e.UserNameSeller, // Payout: e.Payout, // CampaignId: e.CampaignId, // CampaignName: e.CampaignName, // CampaignAlias: e.CampaignAlias, // SellerId: e.SellerId, // CreateDate: e.CreateDate.ToString("dd/MM/yyyy") // ); //}); //var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters.Page, pagerParameters.PageSize); //var pagerShape = Shape.Pager(pager).TotalItemCount(entriesProjection.Count()); var orderStatuses = _orderStatusRepository.Table .Select(s => new OrderStatusItemViewModel { Id = s.Id, Name = s.Name }) .ToList(); var currencies = _currencyRepository.Table .Select(c => new CurrencyItemViewModel { Id = c.Id, Name = c.ShortName }); return(View("Index2", new AdminOrderViewModel { DynamicOrders = orderEntities.Orders.ToArray(), OrderStatuses = orderStatuses, SelectedCurrencyFilterId = filterCurrencyId, Currencies = currencies })); }