public IActionResult Create() { CreateClassRoomViewModel model = new CreateClassRoomViewModel { Categories = this.categoriesService.GetAllAsSelectList(), Stages = this.stagesService.GetAllAsSelectList(), }; return(this.View(model)); }
public async Task <IActionResult> Create(CreateClassRoomViewModel inputModel) { if (!this.ModelState.IsValid) { inputModel.Categories = this.categoriesService.GetAllAsSelectList(); inputModel.Stages = this.stagesService.GetAllAsSelectList(); return(this.View(inputModel)); } string userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.roomsService.CreateClassRoomAsync(userId, inputModel.StageId, inputModel.CategoryId); return(this.Redirect("/ClassRooms/Index")); }