Пример #1
0
 public IActionResult PostChangeRole([FromHeader] string Apikey, [FromBody] roleParams rp)
 {
     try
     {
         if (Enum.TryParse(rp.Role, out Role r))
         {
             if (UserDatabaseAccess.UserChangeRole(_context, Apikey, rp.UserName, r))
             {
                 return(StatusCode(200, "DONE"));
             }
             else
             {
                 return(StatusCode(400, "NOT DONE: Username does not exist"));
             }
         }
         else
         {
             return(StatusCode(400, "NOT DONE: Role does not exist"));
         }
     }
     catch
     {
         return(StatusCode(400, "NOT DONE: An error occured"));
     }
 }