Esempio n. 1
0
		public async Task<IActionResult> AddAdmin(string className, UserToAdd userToAdd)
		{
			var result = await UserService.AddClassroomAdminAsync
			(
				className,
				userToAdd.UserName
			);

			if (result)
			{
				return RedirectToAction("Admins");
			}
			else
			{
				ModelErrors.AddError("UserName", "User not found. (Did the user register?)");
				return View(userToAdd);
			}
		}
		public async Task<IActionResult> AddStudent(string sectionName, UserToAdd userToAdd)
		{
			var result = await UserService.AddSectionStudentAsync
			(
				ClassroomName,
				sectionName,
				userToAdd.UserName
			);

			if (result)
			{
				return RedirectToAction("Students");
			}
			else
			{
				ModelErrors.AddError("UserName", "User not found. (Did the user register?)");
				return View(userToAdd);
			}
		}