public ActionResult Create()
        {
            var viewModel = new CourseViewModel
            {
                Title = "",
                Price = 0,
                ProductTypeId = "",
                SupplierId = "",
                CourseLevelId = 0,
                CategoryId = 0
            };

            var suppliers = RolesService.GetCourseAuthors(_roleManager, _userManager);
            ViewBag.SupplierId = new SelectList(suppliers, "Id", "LfName");
            ViewBag.ProductTypeId = new SelectList(_context.ProductTypes, "Id", "Name");
            ViewBag.CourseLevelId = new SelectList(_context.CourseLevels, "Id", "Name");
            ViewBag.CategoryId = new SelectList(_context.Categories, "Id", "Name");
            ViewBag.TaxId1 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId2 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId3 = new SelectList(_context.Taxes, "Id", "Name");

            return View(viewModel);
        }
        public async Task<ActionResult> Create(CourseViewModel form, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                IList<string> filesList = null;
                if (file != null)
                    filesList = GenerateVersions(file);

                if (filesList != null)
                {
                    form.BigPic = filesList[2];
                    form.MediumPic = filesList[1];
                    form.SmallPic = filesList[0];
                }

                var course = new CourseTemplate
                {
                    Title = form.Title,
                    Price = form.Price,
                    Description = form.Description,
                    BigPic = form.BigPic,
                    MediumPic = form.MediumPic,
                    SmallPic = form.SmallPic,
                    IsLive = form.IsLive,
                    SupplierId = form.SupplierId,
                    ProductTypeId = form.ProductTypeId,
                    CategoryId = form.CategoryId,
                    CourseLevelId = form.CourseLevelId,
                    OverView = form.OverView,
                    Note = form.Note,
                    Tax1Id = form.TaxId1,
                    Tax2Id = form.TaxId2,
                    Tax3Id = form.TaxId3
                };
                _context.CourseTemplates.Add(course);

                await _context.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            var suppliers = RolesService.GetCourseAuthors(_roleManager, _userManager);
            ViewBag.SupplierId = new SelectList(suppliers, "Id", "LfName");
            ViewBag.ProductTypeId = new SelectList(_context.ProductTypes, "Id", "Name", form.ProductTypeId);
            ViewBag.CourseLevelId = new SelectList(_context.CourseLevels, "Id", "Name", form.CourseLevelId);
            ViewBag.CategoryId = new SelectList(_context.Categories, "Id", "Name");
            ViewBag.TaxId1 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId2 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId3 = new SelectList(_context.Taxes, "Id", "Name");

            return View(form);
        }
        public ActionResult Create()
        {
            var viewModel = new CourseViewModel
            {
                Title = "",
                Price = 0,
                ProductTypeId = "",
                SupplierId ="",
                CourseLevelId = 0,
                CategoryId=0
            };

            //ViewBag.ProductMakerId = new SelectList(_context.ProductMakers, "Id", "Name");
            var usersList = _context.Users;
            ViewBag.SupplierId = new SelectList(_context.Users, "Id", "LfName");
            ViewBag.ProductTypeId =  new SelectList(_context.ProductTypes, "Id", "Name");
            ViewBag.CourseLevelId =  new SelectList(_context.CourseLevels, "Id", "Name");
            ViewBag.CategoryId =     new SelectList(_context.Categories, "Id", "Name");
            ViewBag.TaxId1 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId2 = new SelectList(_context.Taxes, "Id", "Name");
            ViewBag.TaxId3 = new SelectList(_context.Taxes, "Id", "Name");

            return View(viewModel);
        }