public IActionResult Put(UserRestModel model)
 {
     if (ModelState.IsValid)
     {
         if (_srv.CheckUserExists(model.Name))
         {
             User user = new User()
             {
                 Name     = model.Name,
                 Password = model.Password
             };
             if (_srv.PutUser(user))
             {
                 return(Ok());
             }
             return(BadRequest("Putting user failed!"));
         }
         return(NotFound($"Couldn't find user with name: \"{model.Name}\"!"));
     }
     return(BadRequest("User model is invalid!"));
 }
 public IActionResult Post(UserRestModel model)
 {
     if (ModelState.IsValid)
     {
         if (!_srv.CheckUserExists(model.Name))
         {
             User user = new User()
             {
                 Name     = model.Name,
                 Password = model.Password
             };
             if (_srv.PostUser(user))
             {
                 return(Ok());
             }
             return(BadRequest("Posting user failed!"));
         }
         return(BadRequest($"User with name \"{model.Name}\" already exists!"));
     }
     return(BadRequest("User model is invalid!"));
 }