public async Task CreateCourseTest(string name) { var account = await _accountBusiness.CreateAccount(new Account { Name = "Base" }); Assert.NotNull(account); Assert.True(account.AccountId > -1); var course = await _courseBusiness.CreateCourse(new Course { Name = name, CourseCode = name, RootAccount = account, Account = account }); Assert.NotNull(course); Assert.Equal(course.Name, name); Assert.NotNull(course.Account); Assert.NotNull(course.RootAccount); Assert.Equal(course.Account.AccountId, account.AccountId); }
public IActionResult Create([FromBody] CourseViewModel courseViewModel) { try { _courseBusiness.CreateCourse(courseViewModel); return(Ok(new { success = true, message = "Created successfully" })); } catch (Exception ex) { return(Ok(new { success = false, message = ex.Message })); } }
public async Task <IActionResult> CreateCourse([FromBody] Course course) { var results = await _courseBusiness.CreateCourse(course); return(Ok(CommonResponse.Success(results))); }