public IActionResult AddSet(SetsViewModel model) { var courseToCreate = new CourseDto() { IDuser = _userManager.GetBy(User.Identity.Name, User.Identity.Name).ID, name = model.Name, describe = model.Describe, link = "" }; _courseServices.CreateCourse(courseToCreate); for (int i = 0; i < model.Term.Count(); i++) { VocabularyDto vocabularyToCreate = new VocabularyDto() { define = model.Term.ElementAt(i), explain = model.DescribeTerm.ElementAt(i), image = "" }; _vocabularyServices.CreateVocabulary(vocabularyToCreate); _vocabularyServices.CreateListVocabulary(_courseServices.GetNewestID(), _vocabularyServices.GetNewestID()); } return(RedirectToAction("Index", "Home")); }
public IEnumerable <Course> CreateCourse(CourseSelectView data) { if (data.account == null || data.account == "") { data.account = User.Identity.Name; } return(_courseServices.CreateCourse(data)); }
public IActionResult Post([FromBody] CourseEntity course) { _courseServices.CreateCourse(course); return(Ok(course)); }