Beispiel #1
0
        public ActionResult RequestAddingAirline()
        {
            //getting info from the form
            string inputUsername    = Request.Form["inputUsername"];
            string inputPassword    = Request.Form["inputPassword"];
            string inputAirlineName = Request.Form["inputAirlineName"];
            string inputCountryId   = Request.Form["inputCountryId"];

            //create list if there isn't any yet
            if (RedisAccessLayer.GetWithTimeStamp("airlineRequestList") == null)
            {
                List <string> airlineRequestList = new List <string>();
                string        aRL = JsonConvert.SerializeObject(airlineRequestList);
                RedisAccessLayer.SaveWithTimeStamp("airlineRequestList", aRL);
            }

            //getting the list
            string        serializedRequestList = RedisAccessLayer.GetWithTimeStamp("airlineRequestList").JsonData;
            List <object> requestList           = JsonConvert.DeserializeObject <List <object> >(serializedRequestList);

            Country country = anonymousFacade.GetCountryById(long.Parse(inputCountryId));

            var airlineRequest = new //creating the item
            {
                Username    = inputUsername,
                Password    = inputPassword,
                AirlineName = inputAirlineName,
                CountryId   = inputCountryId,
                Country     = country.CountryName
            };

            //putting the item in the list
            requestList.Add(airlineRequest);

            //serialize back into redis
            string finishedRequestList = JsonConvert.SerializeObject(requestList);

            RedisAccessLayer.SaveWithTimeStamp("airlineRequestList", finishedRequestList);

            return(Redirect("http://localhost:9002/")); //returning the login screen
        }