Example #1
0
        public ActionResult Post([FromBody] Server server)
        {
            string idOfAddedServer = serverManager.AddServer(server);

            if (idOfAddedServer == null)
            {
                return(BadRequest(idOfAddedServer));
            }
            return(Ok(idOfAddedServer));
        }
 public ActionResult AddServer([FromBody] Server server)
 {
     if (manager.AddServer(server))
     {
         return(Ok());
     }
     else
     {
         return(BadRequest("Received invalid server"));
     }
 }
        public Servers Post(Servers s)
        {
            Uri  uriResult;
            bool result = Uri.TryCreate(s.ServerURL, UriKind.Absolute, out uriResult) &&
                          (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

            if (result == false)
            {
                throw new InvalidOperationException();
            }
            serverModel1.AddServer(s);
            return(s);
        }
Example #4
0
        public ActionResult Post([FromBody] Server server)
        {
            if (!CheckObjects.CheckProperServer(server))
            {
                return(BadRequest());
            }
            string idOfAddedServer = serverManager.AddServer(server);

            if (idOfAddedServer == null)
            {
                return(NotFound(idOfAddedServer));
            }
            return(Ok(idOfAddedServer));
        }
 public void Post([FromBody] Server server)
 {
     serversManager.AddServer(server);
 }