Esempio n. 1
0
        private void createRolesandUsers()
        {
            skiworldContext context = new skiworldContext();

            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));
            var UserManager = new UserManager <user>(new UserStore <user>(context));


            // In Startup iam creating first Admin Role and creating a default Admin User
            if (!roleManager.RoleExists("Admin"))
            {
                // first we create Admin role
                var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole();
                role.Name = "Admin";
                roleManager.Create(role);

                //Here we create a Admin super user who will maintain the website
            }

            // creating Creating Manager role
            if (!roleManager.RoleExists("Client"))
            {
                var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole();
                role.Name = "Client";
                roleManager.Create(role);
            }

            // creating Creating Employee role
            if (!roleManager.RoleExists("Agent"))
            {
                var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole();
                role.Name = "Agent";
                roleManager.Create(role);
            }
        }
Esempio n. 2
0
        public ActionResult Tablesresto(int id)

        {
            skiworldContext sc    = new skiworldContext();
            var             query = from c in sc.restotable.Where(c => c.restaurant_idRestaurant == id)
                                    select c;


            return(View(query));
        }
Esempio n. 3
0
        public ActionResult Menustable(int id)

        {
            skiworldContext sc = new skiworldContext();

            var query = from c in sc.menu.Where(c => c.idRestaurant == id)
                        select c;

            return(View(query));
        }
Esempio n. 4
0
        public List <user> getUsers(int id)
        {
            RoomService                   rs    = new RoomService();
            List <user>                   users = new List <user>();
            IEnumerable <room>            roms  = new List <room>();
            ICollection <roomreservation> rss   = new List <roomreservation>();
            skiworldContext               sc    = new skiworldContext();

            //  roms = rs.getByHotel(id);
            roms = rs.GetAll();

            foreach (room r in roms)
            {
                rss = r.roomreservations;
                foreach (roomreservation rr in rss)
                {
                    users.Add(rr.user);
                }
            }

            /* var query = from c in sc.roomreservation
             *
             *           where c.id_room == id
             *           select c;
             * query.ToList();
             * foreach (roomreservation r in query)
             * {
             *
             *       users.Add(r.user);
             *
             *
             *
             * }*/

            return(users);
        }
Esempio n. 5
0
 public DatabaseFactory()
 {
     dataContext = new skiworldContext();
 }
Esempio n. 6
0
 public AccountController()
 {
     ctx = new skiworldContext();
 }
Esempio n. 7
0
 public UnitOfWork(IDatabaseFactory dbFactory)
 {
     this.dbFactory = dbFactory;
     dataContext    = dbFactory.DataContext;
 }