示例#1
0
 public async Task <ActionResult <bool> > GetAsync(string rId)
 {
     //Since this method is authorized by Identity, it will automatically handle returning 401 if user isn't logged in.
     try
     {
         return((await Arepo.GetFavoritesForUserAsync(User.Identity.Name)).Any(n => n.Id.Equals(rId)));
     }
     catch (Exception e)
     {
         logger.Error(e, e.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
示例#2
0
 public async Task <ActionResult <List <RestaurantModel> > > GetAsync()
 {
     //Since this method is authorized by Identity, it will automatically handle returning 401 if user isn't logged in.
     try
     {
         return(Mapper.Map(await Arepo.GetFavoritesForUserAsync(User.Identity.Name)).ToList());
     }
     catch (Exception e)
     {
         logger.Error(e, e.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }