コード例 #1
0
        public IHttpActionResult DeleteAirlineFromRedis(string key, AirlineCompanie airline)
        {
            string myMail = "*****@*****.**";

            try
            {
                var host = "LocalHost";

                SetRedis.Remove(host, key);
                SendGridServ.Execute(myMail, airline._Email, airline._AirLine_Name, "Email response", "Better luck next time");
                return(Ok());
            }
            catch (Exception ex)
            {
                log.Error(ex);
                log.Info(ex.StackTrace);
                return(BadRequest(ex.Message));
            }
        }
コード例 #2
0
        public IHttpActionResult GetAirlineRedis([FromBody] AirlineCompanie airline)
        {
            try
            {
                string host = "LocalHost";
                string key  = "key" + SetRedis.airlineNum++;
                if (SetRedis.airlineNum == 20)
                {
                    SetRedis.airlineNum = 0;
                }

                SetRedis.setToRedis(host, key, airline.ToString());

                return(Ok());
            }
            catch (Exception ex)
            {
                log.Error(ex);
                log.Info(ex.StackTrace);
                return(BadRequest(ex.Message));
            }
        }
コード例 #3
0
        public IHttpActionResult GetAirlineFromRedis([FromBody] AdministratorDal admin)
        {
            try
            {
                string[] result = new string[50];
                var      host   = "LocalHost";
                var      key    = "key";
                for (int i = 0; i < 50; i++)
                {
                    if (SetRedis.Get(host, key + i) != null)
                    {
                        result[i] = SetRedis.Get(host, key + i) + ",key :" + key + i;
                    }
                }

                return(Ok(result));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                log.Info(ex.StackTrace);
                return(BadRequest(ex.Message));
            }
        }