public AddCourseModel(Course course)
 {
     id = course.id;
     name = course.name;
     description = course.description;
     category_id = course.Category.id;
     sertificate = course.sertificate;
 }
        public ActionResult Create(AddCourseModel courseview)
        {
            if (ModelState.IsValid)
            {

                var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(db));
                var course = new Course() { name = courseview.name, description = courseview.description, Category = db.Categories.Find(courseview.category_id), sertificate = courseview.sertificate };
                course.PublishDate = DateTime.Now;
                course.activated = false;
                course.Author = userManager.FindById(User.Identity.GetUserId());
                db.Courses.Add(course);
                db.SaveChanges();
                return RedirectToAction("Teacher");
            }

            return View(courseview);
        }