//public void Register(ModelBookStore.Login objModellog) //{ // //Login objDLlogin = new Login() // //{ // // UserId=objModellog.UserId, // // Password=objModellog.Password // //}; // UserDetail objUserDetail = new UserDetail() // { // // UserId= objModellog.UserDetails[0].UserId, // FirstName = objModellog.UserDetails[0].FirstName, // LastName = objModellog.UserDetails[0].LastName, // EmailId = objModellog.UserDetails[0].EmailId, // PhoneNumber = objModellog.UserDetails[0].PhoneNumber, // DOB=objModellog.UserDetails[0].DOB, // Address=objModellog.UserDetails[0].Address, // state=objModellog.UserDetails[0].state, // city=objModellog.UserDetails[0].city, // Login= new Login { UserId= objModellog.UserId, Password= objModellog.Password } // }; // //TBSEntities.Logins.Add(objDLlogin); // //TBSEntities.SaveChanges(); // TBSEntities.UserDetails.Add(objUserDetail); // TBSEntities.SaveChanges(); //} public void Register(ModelBookStore.Login objModellog) { if (objModellog.UserDetails == null) { Login objDLlogin = new Login() { UserId = objModellog.UserId, Password = objModellog.Password }; TBSEntities.Logins.Add(objDLlogin); TBSEntities.SaveChanges(); } if (objModellog.UserDetails != null) { UserDetail objUserDetail = new UserDetail() { FirstName = objModellog.UserDetails[0].FirstName, LastName = objModellog.UserDetails[0].LastName, EmailId = objModellog.UserDetails[0].EmailId, PhoneNumber = objModellog.UserDetails[0].PhoneNumber, DOB = objModellog.UserDetails[0].DOB, Address = objModellog.UserDetails[0].Address, state = objModellog.UserDetails[0].state, city = objModellog.UserDetails[0].city //Login = new Login { UserId = objModellog.UserId, Password = objModellog.Password } }; TBSEntities.UserDetails.Add(objUserDetail); TBSEntities.SaveChanges(); } }
public void Add(ModelBookStore.Role objModelRole) { Role objRole = new Role() { Name = objModelRole.Name }; TBSEntities.Roles.Add(objRole); TBSEntities.SaveChanges(); }
public void Add(ModelBookStore.UserRole objModelUserRole) { UserRole objUserRole = new UserRole() { UserId = objModelUserRole.UserId, RoleId = objModelUserRole.RoleId }; TBSEntities.UserRoles.Add(objUserRole); TBSEntities.SaveChanges(); }
public void Add(ModelBookStore.Item objModelItem) { Item objItem = new Item() { Name = objModelItem.Name, Price = objModelItem.Price }; TBSEntities.Items.Add(objItem); TBSEntities.SaveChanges(); }
public void Add(ModelBookStore.UserItem objModelUserItem) { UserItem objUserItem = new UserItem() { UserId = objModelUserItem.UserId, DateOfPurchase = objModelUserItem.DateOfPurchase, ItemId = objModelUserItem.ItemId, NoOfItems = objModelUserItem.NoOfItems, DiscAmmount = objModelUserItem.DiscAmmount, NetAmount = objModelUserItem.NetAmount }; TBSEntities.UserItems.Add(objUserItem); TBSEntities.SaveChanges(); }