コード例 #1
0
        public IActionResult AddUserToClass(string userName, int classId)
        {
            // Assume the user is not authorized
            IActionResult result = Unauthorized();

            try
            {
                var row = _db.AddUserToClass(userName, classId);
                result = Ok(row);
            }
            catch (Exception)
            {
                result = BadRequest(new { Message = "Failed to add user to class" });
            }

            return(result);
        }