コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            int param;
            if (int.TryParse(context.Request.QueryString["id"], out param))
            {
                using (var db = new GrubCaddieContext())
                {
                    if (param == -1)
                    {
                        bytes = File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/Images/add.png"));

                        context.Response.ContentType = "image/png";
                    }
                    else
                    {
                        var data = (from x in db.Menus
                                    where x.Id == (short)param
                                    select x).FirstOrDefault();

                        bytes = data.Image;

                        context.Response.ContentType = "image/" + data.ImageFileType;
                    }

                    context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    context.Response.BinaryWrite(bytes);
                    context.Response.Flush();
                    context.Response.End();
                }
            }
            else
            {
                //image not found
            }
        }
コード例 #2
0
 public MenuItemRepository(GrubCaddieContext gc)
 {
     this.GCContext = gc;
 }
コード例 #3
0
 public ProfileRepository(GrubCaddieContext gc)
 {
     this.GCContext = gc;
 }