public async Task <IActionResult> UpdateFavorites([FromBody] List <int> favoritIds, string id)
        {
            var user = await UserManager.FindByIdAsync(id);

            if (user == null)
            {
                return(NotFound());
            }

            if (this.User.Claims.FirstOrDefault(c => c.Type == "UserId").Value != id)
            {
                return(Unauthorized());
            }

            if (favoritIds != null)
            {
                List <string> errorCodes = RecipesController.ControlRecipesIds(favoritIds);
                if (errorCodes.Count > 0)
                {
                    return(BadRequest(errorCodes));
                }

                IFavoriteManager fm = new FavoriteManager();
                fm.Remove(id);
                fm.Add(favoritIds, id);
            }

            await UserManager.UpdateAsync(user);

            return(NoContent());
        }
        public ActionResult AddFavorite(int Id)
        {
            var userManager = new UserManager();
            var favoriteManager = new FavoriteManager();

            var favorite = new Favorite();
            var login = System.Web.HttpContext.Current.User.Identity.Name;

            favorite.Restaurant = _rstManager.Get(Id);
            favorite.User = userManager.Get().FirstOrDefault(u => u.Login == login);
            favoriteManager.Add(favorite);
            return Json(new {result = "success"}, JsonRequestBehavior.AllowGet);
        }