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()); } }
public CelebrityIndustry Get(string name) { using (var c = new CelebrityHologramContext()) { return(c.CelebrityIndustry.FirstOrDefault(u => u.Name == name)); } }
public List <CelebrityIndustry> Get() { using (var c = new CelebrityHologramContext()) { return(c.CelebrityIndustry.ToList()); } }
public List <CelebrityGroup> Get() { using (var c = new CelebrityHologramContext()) { return(c.CelebrityGroup.ToList()); } }
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)); } }
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)); } }
public CelebrityGroup Update(CelebrityGroup celebGroup) { using (var c = new CelebrityHologramContext()) { c.CelebrityGroup.Update(celebGroup); var id = c.SaveChanges(); return(celebGroup); } }
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); } }
public Celebrity Update(Celebrity celeb) { using (var c = new CelebrityHologramContext()) { c.Celebrity.Update(celeb); var id = c.SaveChanges(); return(celeb); } }
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(); }
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); }