public Account Login(Account account) { OnlineMobileShoppingContext context = new OnlineMobileShoppingContext(); var result = context.AccountDB.Where(user => user.MailId == account.MailId && user.Password == account.Password).FirstOrDefault(); return(result); }
//public Brand GetBrandId(int id) //{ // using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) // { // Brand brand = context.BrandDB.Find(id); // return brand; // } //} public IEnumerable <Brand> GetBrand() { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { return(context.BrandDB.ToList()); } }
public Account GetUserId(int userId) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Account user = context.AccountDB.Find(userId); return(user); } }
public IEnumerable <Account> DisplayUsers() { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { List <Account> user = context.AccountDB.ToList(); return(user); } }
public IEnumerable <Mobile> DisplayMobile() { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { List <Mobile> mobile = context.MobileDB.Include("Brand").ToList(); return(mobile); } }
public void SignUp(Account user) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { context.AccountDB.Add(user); context.SaveChanges(); } }
public void Create(Mobile mobile) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { context.MobileDB.Add(mobile); context.SaveChanges(); } }
public void Create(Brand brand) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { context.BrandDB.Add(brand); context.SaveChanges(); } }
public void DeleteUser(int id) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Account user = context.AccountDB.Find(id); context.AccountDB.Remove(user); context.SaveChanges(); } }
public IEnumerable <Account> GetUserDetails(Account user) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { //Account account = GetUserId(user.MailId); var result = context.AccountDB.Where(Value => Value.MailId == user.MailId); return(result); } }
public void DeleteMobile(int id) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Mobile mobile = context.MobileDB.Find(id); context.MobileDB.Remove(mobile); context.SaveChanges(); } }
public Brand GetMobile(int id) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { List <Mobile> mobile = context.MobileDB.ToList(); Brand product = context.BrandDB.Where(key => key.BrandId == id).SingleOrDefault(); return(product); } }
public Mobile GetMobileId(int mobileId) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Mobile mobile = context.MobileDB.Find(mobileId); return(mobile); } // return mobiles.Find(id => id.Id == mobileId); }
public IEnumerable <Mobile> GetBrand(int brandId) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { List <Mobile> result = context.MobileDB. Where(x => x.BrandId == brandId).ToList(); return(result); } }
public void DeleteBrand(int id) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Brand brand = context.BrandDB.Find(id); context.BrandDB.Remove(brand); context.SaveChanges(); } }
public void UpdateBrand(Brand brand) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Brand updateBrand = context.BrandDB.Find(brand); context.Entry(brand).State = EntityState.Modified; // updateBrand.BrandName = brand.BrandName; context.SaveChanges(); } }
public void UpdateUser(Account user) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Account updateUser = context.AccountDB.Find(user.UserId); updateUser.UserName = user.UserName; updateUser.MailId = user.MailId; updateUser.Password = user.Password; // updateUser.UpdatedDate = user.UpdatedDate; updateUser.MobileNo = user.MobileNo; updateUser.LastLoginTime = user.LastLoginTime; updateUser.Gender = user.Gender; updateUser.City = user.City; updateUser.Age = user.Age; context.SaveChanges(); } }
public void UpdateMobile(Mobile mobile) { using (OnlineMobileShoppingContext context = new OnlineMobileShoppingContext()) { Mobile updateMobile = context.MobileDB.Find(mobile.Id); context.Entry(mobile).State = EntityState.Modified; // updateMobile.BrandName = mobile.BrandName; //updateMobile.Id =mobile.Id; //updateMobile.BatteryCapacity = mobile.BatteryCapacity; //updateMobile.Color = mobile.Color; //updateMobile.DisplaySize= mobile.DisplaySize; //updateMobile.MobileModel = mobile.MobileModel; //updateMobile.Pixel = mobile.Pixel ; //updateMobile.Price= mobile.Price ; //updateMobile.Processor = mobile.Processor; //updateMobile.RAM = mobile.RAM ; //updateMobile.Slimness= mobile.Slimness; //updateMobile.Storage = mobile.Storage; context.SaveChanges(); } }