public async Task <IActionResult> InsertClasses(IndexClassListVM obj) { try { if (ModelState.IsValid) { if (obj.Classes != null) { var Classes = new InsertClass_Classes() { Id = obj.Classes.Id, Name = obj.Classes.Name }; var model = new InsertClass2() { Classes = Classes }; await Task.Run(() => _classesServ.InsertClass(model)); } } } catch (Exception) { return(BadRequest()); } return(RedirectToAction("ClassList")); }