public async Task <IActionResult> LevelAdd(CourseLevelModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var level = new CourseLevel(); level = model.ToEntity(level); await _courseLevelService.Insert(level); return(new NullJsonResult()); }
public async Task <IActionResult> LevelUpdate(CourseLevelModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var level = await _courseLevelService.GetById(model.Id); level = model.ToEntity(level); await _courseLevelService.Update(level); return(new NullJsonResult()); }