Esempio n. 1
0
        public IActionResult Index()
        {
            FitBodyContext context = new FitBodyContext();
            var            details = from supplement in context.Supplements
                                     join orderline in context.OrderLines on supplement.ID equals orderline.SupplementID
                                     select new OrderDetailsModel()
            {
                SupplementName = supplement.SupplementName,
                Price          = orderline.Price,
                Quantity       = orderline.Quantity,
                Id             = orderline.ID,
                Time           = orderline.Time
            };
            AdminIndexViewModel model = new AdminIndexViewModel()
            {
                CustomIdentityContexts = _customIdentityContext.Users.ToList(),
                Supplements            = _supplementService.GetAll(),
                OrderDetailsModels     = details.OrderByDescending(x => x.Name).ThenBy(x => x.Time).ToList(),
                UnitInStock            = _supplementService.GetAllUnitInStock(),
                SaleCount     = _orderLineService.GetAllSaleCount(),
                UserCount     = _customIdentityContext.Users.Count(),
                BlogPostCount = _blogPostService.GetBlogPostCount(),
            };

            return(View(model));
        }
Esempio n. 2
0
        public IActionResult Details(int supplementId)
        {
            FitBodyContext context = new FitBodyContext();
            var            details = from supplement in context.Supplements
                                     join category in context.SupplementCategories on supplement.SupplementCategoryID equals category.ID
                                     join subCategory in context.SupplementSubCategories on category.ID equals subCategory
                                     .SupplementCategoryID
                                     where supplement.ID == supplementId
                                     select new SupplementDetailsViewModel()
            {
                Image                     = supplement.Image,
                SupplementName            = supplement.SupplementName,
                Id                        = supplement.ID,
                CategoryId                = category.ID,
                SubCategoryId             = subCategory.ID,
                SupplementCategoryName    = category.CategoryName,
                SupplementSubCategoryName = subCategory.SuplementSubCategoryName,
                UnitPrice                 = supplement.Price,
                Description               = supplement.Description
            };
            SupplementDetailsListViewModel supplementDetailsListViewModel = new SupplementDetailsListViewModel()
            {
                SupplementDetailsViewModel = details.FirstOrDefault()
            };

            return(View(supplementDetailsListViewModel));
        }
Esempio n. 3
0
 public BaseDataService(
     FitBodyContext context,
     IMapper mapper
     )
 {
     _table   = context.Set <TModel>();
     _context = context;
     _mapper  = mapper;
 }
Esempio n. 4
0
        public IActionResult AboutUpdate(int aboutId)
        {
            FitBodyContext fitBodyContext = new FitBodyContext();
            AboutViewModel aboutViewModel = new AboutViewModel()
            {
                About = fitBodyContext.Abouts.Where(x => x.ID == aboutId).FirstOrDefault(),
            };

            return(View(aboutViewModel));
        }
Esempio n. 5
0
        public IActionResult Index()
        {
            FitBodyContext fitBodyContext = new FitBodyContext();
            AboutViewModel aboutViewModel = new AboutViewModel()
            {
                About = fitBodyContext.Abouts.SingleOrDefault(),
            };



            return(View(aboutViewModel));
        }
Esempio n. 6
0
        public IActionResult AboutUpdate(About about)
        {
            if (ModelState.IsValid)
            {
                using (FitBodyContext context = new FitBodyContext())
                {
                    context.Abouts.Update(about);
                    context.SaveChanges();
                }
                TempData.Add("message", "About successfully updated");
            }

            return(View());
        }
Esempio n. 7
0
        public IActionResult Details(int orderId = 0)
        {
            FitBodyContext context = new FitBodyContext();
            var            details = from o in context.Orders
                                     join ol in context.OrderLines on o.ID equals ol.OrderID
                                     join s in context.Supplements on ol.SupplementID equals s.ID
                                     join sd in context.ShippingDetails on o.ShippingDetailId equals sd.ID

                                     where o.ID == orderId
                                     select new OrderDetailsModel()
            {
                Image          = s.Image,
                Quantity       = ol.Quantity,
                SupplementName = s.SupplementName,
                Price          = ol.Price,
                Total          = o.Total,
                AccountId      = o.AccountId,
                City           = sd.City,
                District       = sd.District,
                Neighborhood   = sd.Neighborhood,
                SupplementId   = s.ID,
                Name           = sd.Name,
                Surname        = sd.Surname,
                Time           = sd.Time,
            };
            OrderDetailsListModel orderDetailsListModel = new OrderDetailsListModel
            {
                OrderDetailsModels = details.ToList(),
                Orders             = _orderService.GetOrderById(orderId),
            };

            if (orderId == 0)
            {
                orderDetailsListModel.Orders =
                    _orderService.GetOrderByAccountId(_userManager.GetUserId(HttpContext.User));
            }
            return(View(orderDetailsListModel));
        }
 public ThreadService(FitBodyContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public TopicSuggestedService(FitBodyContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public CommentService(FitBodyContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public UserService(FitBodyContext context, IMapper mapper, IOptions <AppSettings> options)
 {
     _context = context;
     _mapper  = mapper;
     _options = options;
 }
 public SubcategoryService(FitBodyContext context, IMapper mapper) : base(context, mapper)
 {
 }
Esempio n. 13
0
 public NotificationService(FitBodyContext context)
 {
     _context = context;
 }