public List <Models.HologramType> GetAll()
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.HologramType.ToList());
     }
 }
 public User Get(string username, string password)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.User.FirstOrDefault(u => u.UserName == username && u.Password == password));
     }
 }
 public HologramEvent Get(string name)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.HologramEvent.FirstOrDefault(u => u.Name == name));
     }
 }
 public User Get(int userId)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.User.FirstOrDefault(u => u.UserId == userId));
     }
 }
 public List <User> Get(string username)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.User.Where(u => u.UserName == username).ToList());
     }
 }
Ejemplo n.º 6
0
 public CelebrityIndustry Get(string name)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.CelebrityIndustry.FirstOrDefault(u => u.Name == name));
     }
 }
Ejemplo n.º 7
0
 public List <CelebrityIndustry> Get()
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.CelebrityIndustry.ToList());
     }
 }
Ejemplo n.º 8
0
 public List <CelebrityGroup> Get()
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.CelebrityGroup.ToList());
     }
 }
Ejemplo n.º 9
0
 public Celebrity Get(int id)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.Celebrity.FirstOrDefault(u => u.CelebrityId == id));
     }
 }
 public HologramEvent Get(int id)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.HologramEvent.FirstOrDefault(u => u.HologramEventId == id));
     }
 }
Ejemplo n.º 11
0
 public Celebrity Get(string firstname, string lastname, string middlename)
 {
     using (var c = new CelebrityHologramContext())
     {
         return(c.Celebrity.FirstOrDefault(u => u.FirstName == firstname &&
                                           u.LastName == lastname && u.MiddleName == middlename));
     }
 }
Ejemplo n.º 12
0
 public CelebrityGroup Update(CelebrityGroup celebGroup)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.CelebrityGroup.Update(celebGroup);
         var id = c.SaveChanges();
         return(celebGroup);
     }
 }
Ejemplo n.º 13
0
 public int Save(CelebrityGroup celebGroup)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.CelebrityGroup.Add(celebGroup);
         c.SaveChanges();
         return(celebGroup.CelebrityGroupId);
     }
 }
 public int Save(User user)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.User.Add(user);
         c.SaveChanges();
         return(user.UserId);
     }
 }
Ejemplo n.º 15
0
 public Celebrity Update(Celebrity celeb)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.Celebrity.Update(celeb);
         var id = c.SaveChanges();
         return(celeb);
     }
 }
Ejemplo n.º 16
0
 public int Save(Celebrity celeb)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.Celebrity.Add(celeb);
         c.SaveChanges();
         return(celeb.CelebrityId);
     }
 }
 public HologramEvent Update(HologramEvent hEvent)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.HologramEvent.Update(hEvent);
         var id = c.SaveChanges();
         return(hEvent);
     }
 }
 public int Save(HologramEvent hEvent)
 {
     using (var c = new CelebrityHologramContext())
     {
         c.HologramEvent.Add(hEvent);
         c.SaveChanges();
         return(hEvent.HologramEventId);
     }
 }
        public static void Seed(CelebrityHologramContext context)
        {
            //context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            if (!context.User.Any())
            {
                context.User.Add(
                    new Models.User
                {
                    CreatedBy   = "Suhas",
                    DateCreated = DateTime.Now,
                    DateUpdated = DateTime.Now,
                    Password    = "******",
                    UpdatedBy   = "Suhas",
                    UserName    = "******"
                });
                context.User.Add(
                    new Models.User
                {
                    CreatedBy   = "Suhas",
                    DateCreated = DateTime.Now,
                    DateUpdated = DateTime.Now,
                    Password    = "******",
                    UpdatedBy   = "Suhas",
                    UserName    = "******"
                });
            }

            if (!context.HologramType.Any())
            {
                context.HologramType.Add(new Models.HologramType
                {
                    CreatedBy   = "Suhas",
                    DateCreated = DateTime.Now,
                    DateUpdated = DateTime.Now,
                    UpdatedBy   = "Suhas",
                    Description = "Light is shone through the hologram",
                    Name        = "Transmission"
                });

                context.HologramType.Add(new Models.HologramType
                {
                    CreatedBy   = "Suhas",
                    DateCreated = DateTime.Now,
                    DateUpdated = DateTime.Now,
                    UpdatedBy   = "Suhas",
                    Description = "The hologram reflects light",
                    Name        = "Reflection "
                });
            }

            context.SaveChanges();
        }
Ejemplo n.º 20
0
        public void Delete(int id)
        {
            using (var c = new CelebrityHologramContext())
            {
                var celeb = Get(id);

                if (celeb != null)
                {
                    celeb.Deleted = true;
                    Update(celeb);
                }
            }
        }
        public void Delete(int id)
        {
            using (var c = new CelebrityHologramContext())
            {
                var hEvent = Get(id);

                if (hEvent != null)
                {
                    hEvent.Deleted = true;
                    Update(hEvent);
                }
            }
        }
        public List <CelebrityHologramSearch> Get()
        {
            using (var c = new CelebrityHologramContext())
            {
                var responses = (from ch in c.CelebrityHologram
                                 join h in c.HologramEvent on ch.HologramEventId equals h.HologramEventId
                                 join cl in c.Celebrity on ch.CelebrityId equals cl.CelebrityId
                                 select new CelebrityHologramSearch
                {
                    HologramEvents = h,
                    Holograms = ch,
                    Celebrity = cl
                }

                                 ).ToList();

                return(responses);
            }
        }
        public CelebrityHologramSearch Get(int celebrityHologramId)
        {
            using (var c = new CelebrityHologramContext())
            {
                var response = (from ch in c.CelebrityHologram
                                join h in c.HologramEvent on ch.HologramEventId equals h.HologramEventId
                                join cl in c.Celebrity on ch.CelebrityId equals cl.CelebrityId
                                where ch.CelebrityHologramId == celebrityHologramId
                                select new CelebrityHologramSearch
                {
                    HologramEvents = h,
                    Holograms = ch,
                    Celebrity = cl
                }

                                ).FirstOrDefault();

                return(response);
            }
        }
        public static void Migrate()
        {
            var context = new CelebrityHologramContext();

            ContextSeeder.Seed(context);
        }