示例#1
0
 public ActionResult <List <string> > Get(string rId)
 {
     try
     {
         return(Arepo.GetUsers(true).Where(a => a.Blacklist.Any(f => f.RestaurantId.Equals(rId))).Select(a => a.Username).ToList());
     }
     catch (Exception e)
     {
         logger.Error(e, e.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
示例#2
0
        [Authorize(Roles = "admin")]//checking if you are in some role, to access something
        public ActionResult <List <UserModel> > Get()
        {
            List <AppUser> userlist;

            try
            {
                userlist = Arepo.GetUsers().ToList();
            }
            catch (Exception e)
            {
                logger.Error(e, e.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
            if (userlist == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            return(Mapper.Map(userlist).ToList());
        }