Exemplo n.º 1
0
        public async Task <IActionResult> Create(SubModuleVm model)
        {
            if (ModelState.IsValid)
            {
                var SubModule = new SubModule()
                {
                    // CourseId= model.CourseId,
                    ModuleId = model.ModuleId,
                    Title    = model.Title,
                    Content  = model.Content,
                };
                if (model.File != null)
                {
                    SubModule.File = hostingEnvironment.UploadFileToFolder(model.File);
                }


                _context.Add(SubModule);



                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public IActionResult Create(int id)
        {
            var subModule = new SubModuleVm();

            subModule.ModuleId = id;


            return(View(subModule));
        }