public IActionResult AddCourseCategory([FromForm] CommonCourseCategoryBannerModel model) { CourseCategory courseCategory = new CourseCategory(); courseCategory.Name = model.Name; if (model.Files != null && model.Files.Count > 0) { courseCategory.ImageUrl = _fileService.SaveFile(model.Files, ClassBookConstant.ImagePath_CourseCategory); } courseCategory.Active = true; _context.CourseCategory.Add(courseCategory); _context.SaveChanges(); return(Ok()); }
public IActionResult AddAdvertisementBanner([FromForm] CommonCourseCategoryBannerModel model) { AdvertisementBanner advertisementBanner = new AdvertisementBanner(); advertisementBanner.Name = model.Name; advertisementBanner.Description = model.Description; if (model.Files.Count > 0) { advertisementBanner.ImageUrl = _fileService.SaveFile(model.Files, ClassBookConstant.ImagePath_AdvertisementBanner); } advertisementBanner.Active = true; _context.AdvertisementBanner.Add(advertisementBanner); _context.SaveChanges(); return(Ok()); }
public IActionResult AddCourses([FromForm] CommonCourseCategoryBannerModel model) { Courses courses = new Courses(); courses.Name = model.Name; courses.CategoryId = model.CategoryId; courses.Description = model.Description; if (model.Files.Count > 0) { courses.ImageUrl = _fileService.SaveFile(model.Files, ClassBookConstant.ImagePath_Courses); } courses.Active = true; _context.Courses.Add(courses); _context.SaveChanges(); return(Ok()); }