예제 #1
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            using (var ctx = new Database.DBContainer())
            {

            }
            return View();
        }
예제 #2
0
        public ActionResult Index(int id)
        {
            using (var db = new Database.DBContainer())
            {
                var photo = db.Photos.Find(id);

                return File(photo.Data, "image/jpg");
            }
        }
예제 #3
0
파일: DBCtx.cs 프로젝트: pgodwin/AlleyCat
 public static Database.DBContainer GetContext()
 {
     var ctx = new Database.DBContainer();
     ctx.Configuration.LazyLoadingEnabled = false;
     return ctx;
 }
예제 #4
0
파일: Program.cs 프로젝트: pgodwin/AlleyCat
        static void Main(string[] args)
        {
            using (var context = new Database.DBContainer())
            {
                //context.Users.Add(new Database.User { FirstName = "John", LastName = "Smith", Facebook_Id = "bigboy" });
                //context.SaveChanges();
                //var usr = context.Users.FirstOrDefault(q => q.Id == 2);

                //var hunt1 = context.Hunts.FirstOrDefault(q => q.Id == 1);
                //hunt1.Members.Add(new Database.Membership { User = usr });
                //var hunt2 = context.Hunts.FirstOrDefault(q => q.Id == 2);
                //hunt2.Members.Add(new Database.Membership { User = usr });
                //context.SaveChanges();
                //    //var hunt = new Database.Hunt();
                //    //hunt.Name = "hunt 2";
                //    //hunt.Start = DateTime.Now.AddDays(1);
                //    //hunt.Finish = DateTime.Now.AddDays(31);
                //    //hunt.Owner = usr;
                //    //hunt.InviteCode = "GHIJKL";
                //    //hunt.DateCreated = DateTime.Now;

                //    //context.Hunts.Add(hunt);

                //    //context.SaveChanges();

                //    context.Waypoints.Add(new Database.Waypoint
                //    {
                //        Hunt = hunt,
                //        Lat = -11.252888,
                //        Long = 146.801508,
                //        Name = "WP1",
                //        Order = 1
                //    });
                //    context.Waypoints.Add(new Database.Waypoint
                //    {
                //        Hunt = hunt,
                //        Lat = -11.285702,
                //        Long = 146.788032,
                //        Name = "WP2",
                //        Order = 2

                //    });
                //    context.Waypoints.Add(new Database.Waypoint
                //    {
                //        Hunt = hunt,
                //        Lat = -11.312839,
                //        Long = 146.759022,
                //        Name = "WP3",
                //        Order = 3
                //    });

                //    context.SaveChanges();

                //    //var img1 = System.IO.File.ReadAllBytes(@"D:\imgs\20.jpg");
                //    //var img2 = System.IO.File.ReadAllBytes(@"D:\imgs\21.jpg");
                //    //var img3 = System.IO.File.ReadAllBytes(@"D:\imgs\22.jpg");

                   var wp1 = context.Waypoints.FirstOrDefault(q => q.Id == 1);
                   var wp2 = context.Waypoints.FirstOrDefault(q => q.Id == 2);
                   var wp3 = context.Waypoints.FirstOrDefault(q => q.Id == 3);

                //    //wp1.Photos.Add(new Database.Photo { Data = img1 });

                   wp1.Lat = -19.327667;
                   wp1.Long = 146.756270;

                   wp2.Lat = -19.327736;
                   wp2.Long = 146.756954;

                   wp3.Lat = -19.328262;
                   wp3.Long = 146.757137;
                //   // wp3.Photos.Add(new Database.Photo { Data = img3 });

                //    wp1.Clues.Add(new Database.Clue { Description = "Yo mama" });
                //    wp2.Clues.Add(new Database.Clue { Description = "so butch," });
                //    wp3.Clues.Add(new Database.Clue { Description = "she threw the shot-put in high-school." });
                  context.SaveChanges();

            }
        }