public IHttpActionResult CreateBookmark(BookmarkRequestModel model)
        {
            var userId = this.User.Identity.GetUserId();

            if (!ModelState.IsValid || model == null)
            {
                return(BadRequest("Bookmark not added"));
            }

            if (bookmarkService.Exist(model.Url, userId))
            {
                return(BadRequest("Bookmark already added"));
            }

            var tags    = Mapper.Map <IEnumerable <TagRequestModel>, IEnumerable <Tag> >(model.Tags);
            var website = Mapper.Map <Website>(model.Website);

            bookmarkService.Add(model.Title, model.Url, model.Description, model.SnapshotBase64String, tags, website, userId);

            return(Ok("bookmark added"));
        }
Example #2
0
 public ActionResult Bookmark(Guid contentId)
 {
     _bookmarksService.Add(contentId);
     return(Json(new { Success = true }));
 }