public new Device Update()
        {
            try
            {
                string url  = IoC.API_URL + "device/updateAndReturn";
                string json = Connect_dl.BuildJson(this, true);

                HttpWebRequest       request = Connect_dl.BuildRequest(url, "POST", json);
                Tuple <bool, string> result  = ValidateResponse(request);

                if (result.Item1)
                {
                    Device deviceUpdate = Newtonsoft.Json.JsonConvert.DeserializeObject <Device>(result.Item2);
                    return(deviceUpdate);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
        public new ParkingLot Create()
        {
            string url  = IoC.API_URL + "parkingLot/create";
            string json = Connect_dl.BuildJson(this);

            HttpWebRequest request = Connect_dl.BuildRequest(url, "POST", json);

            return(ValidateResponse("Create", request) as ParkingLot);
        }
        public new List <Device> GetCamerasDeployed()
        {
            string url  = IoC.API_URL + "parkingLot/getCamerasDeployedAtParkingLot";
            string json = Connect_dl.BuildJson(this);

            HttpWebRequest request = Connect_dl.BuildRequest(url, "POST", json);

            return(ValidateResponse("GetCamerasDeployed", request) as List <Device>);
        }
        public new bool?SignUp()
        {
            string url  = IoC.API_URL + "company/signUp";
            string json = Connect_dl.BuildJson(this);

            HttpWebRequest request = Connect_dl.BuildRequest(url, "POST", json);

            if (request != null)
            {
                Dictionary <HttpStatusCode, string> response = Connect_dl.GetResponse(request);
                HttpStatusCode code         = response.FirstOrDefault().Key;
                string         httpResponse = response.FirstOrDefault().Value;

                if (code == HttpStatusCode.OK)
                {
                    //clear company in IoC, return true
                    Company company = new Company();
                    IoC.CurrentCompany = company;
                    return(true);
                }
                else
                {
                    if (httpResponse == "Company already exists with specified username.")
                    {
                        //clear company, return false for incorrect username/password
                        IoC.ClearSessionIoC();
                        return(false);
                    }
                    else
                    {
                        //clear company, return null for server error
                        IoC.ClearSessionIoC();
                        return(null);
                    }
                }
            }
            else
            {
                //clear company, return null for server error
                IoC.ClearSessionIoC();
                return(null);
            }
        }
        public new bool?Login()
        {
            string url  = IoC.API_URL + "company/login";
            string json = Connect_dl.BuildJson(this);

            HttpWebRequest request = Connect_dl.BuildRequest(url, "POST", json);

            if (request != null)
            {
                Dictionary <HttpStatusCode, string> response = Connect_dl.GetResponse(request);
                HttpStatusCode code         = response.FirstOrDefault().Key;
                string         httpResponse = response.FirstOrDefault().Value;

                if (code == HttpStatusCode.OK)
                {
                    //save company in IoC, return true
                    Company currentCompany = Newtonsoft.Json.JsonConvert.DeserializeObject <Company>(httpResponse);
                    IoC.CurrentCompany = currentCompany;
                    return(true);
                }
                else
                {
                    if (httpResponse == "Incorrect Username or Password")
                    {
                        //clear company, return false for incorrect username/password
                        IoC.ClearSessionIoC();
                        return(false);
                    }
                    else
                    {
                        //clear company, return null for server error
                        IoC.ClearSessionIoC();
                        return(null);
                    }
                }
            }
            else
            {
                //clear company, return null for server error
                IoC.ClearSessionIoC();
                return(null);
            }
        }