예제 #1
0
        public ActionResult AddToBookmarks(CategorySearchSortModel model)
        {
            var status = "success";

            try
            {
                switch (model.Category)
                {
                case CategorySearch.Announcement:
                    _announcementBookmarkRepository.Save(new AnnouncementBookmark()
                    {
                        AnnouncementId = model.Id,
                        UserId         = WebSecurity.CurrentUserId
                    });
                    break;

                case CategorySearch.Realty:
                    _realtyBookmarkRepository.Save(new RealtyBookmark()
                    {
                        RealtyId = model.Id,
                        UserId   = WebSecurity.CurrentUserId
                    });
                    break;

                case CategorySearch.Product:
                    _productBookmarkRepository.Save(new ProductBookmark()
                    {
                        ProductId = model.Id,
                        UserId    = WebSecurity.CurrentUserId
                    });
                    break;

                default:
                    status = "fail";
                    break;
                }
            }
            catch
            {
                status = "fail";
            }

            return(Json(new { status = status }, "text/html"));
        }
예제 #2
0
        public ActionResult AddToBookmarks(CategorySearchSortModel model)
        {
            var status = "success";

            try
            {
                _bookmarkRepository.Save(new RealtyBookmark()
                {
                    RealtyId = model.Id,
                    UserId   = WebSecurity.CurrentUserId
                });
            }
            catch
            {
                status = "fail";
            }

            return(Json(new { status = status }, "text/html"));
        }