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); }
public ActionResult RemoveFavorite(Favorite item) { var fvrManager = new FavoriteManager(); var user = GetUserByLogin(); fvrManager.Delete(item.Id, user.Id); return View(); }