コード例 #1
0
        public IHttpActionResult Post([FromBody] Item item)
        {
            clResponse resp = new clResponse();

            resp.Date = DateTime.Now;

            try
            {
                List <Item> items = (List <Item>)HttpContext.Current.Session["MyStoredValue"];
                if (items == null)
                {
                    items = new List <Item>();
                }
                items.Add(item);
                HttpContext.Current.Session["MyStoredValue"] = items;
                resp.Result = "Succes";
                resp.Status = 0;
            }
            catch (Exception ex)
            {
                resp.Result = ex.StackTrace;
                resp.Status = -1;
            }

            return(Ok(resp));
        }
コード例 #2
0
        public IHttpActionResult GetBookmark()
        {
            clResponse resp = new clResponse();

            resp.Date = DateTime.Now;

            try
            {
                resp.Result = HttpContext.Current.Session["MyStoredValue"];
                resp.Status = 0;
            }
            catch (Exception ex)
            {
                resp.Result = ex.StackTrace;
                resp.Status = -1;
            }
            return(Ok(HttpContext.Current.Session["MyStoredValue"]));
        }