Esempio n. 1
0
        // GET: api/Catalogues
        public IHttpActionResult GetCatalogues()
        {
            UserInformation user1 = new UserInformation(new MyRoomDbContext());
            user1.InformationUser(HttpContext.Current.User.Identity.Name);
           var Id = user1.IdUser;
           var rol = user1.Rol;

            if (rol == "Admins")
                return Ok(catalogRepository.GetAll());

            return Ok(catalogRepository.GetCatalogByUser(Id));
        }
Esempio n. 2
0
        //private AccountRepository _genericRepository = new AccountRepository(new MyRoomDbContext());
        //MyRoomDbContext db = new MyRoomDbContext();

        // GET: odata/Hotels        
        public IHttpActionResult GetHotels()
        {
            UserInformation user1 = new UserInformation(new MyRoomDbContext());
            user1.InformationUser(HttpContext.Current.User.Identity.Name);
            var Id = user1.IdUser;
            var rol = user1.Rol;
            if (rol == "Admins")
            {
                //var a = HttpContext.Current.User.Identity.GetUserId();
                //return Ok(hotelRepository.GetHotelsByUser(HttpContext.Current.User.Identity.GetUserId()));
                return Ok(hotelRepository.GetAll());
            }
            return Ok(hotelRepository.GetHotelsByUser(Id));
        }