コード例 #1
0
 public IActionResult AddStopRouteToFavourites([FromBody] FavouriteStopRouteModel favouriteStop)
 {
     return(Json(new
     {
         succeeded = _context.AddStopRouteToFavourites(favouriteStop)
     }));
 }
コード例 #2
0
        public async Task <IActionResult> AddToFavourite(FavouriteStopRouteModel favouriteStop)
        {
            if (ModelState.IsValid)
            {
                ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User);

                favouriteStop.UserId = user.Id;

                return(Json(_context.AddStopRouteToFavourites(favouriteStop)));
            }

            return(Json(false));
        }