public void Add(Bookmark entity) { _repository.Add(entity); if (!string.IsNullOrEmpty(entity.Id)) { AddToCache(entity); } }
public Bookmark Handle(CreateBookmarkRequest request) { Bookmark bookmark = new Bookmark { Url = "http://" + request.FeatureId }; bookmarkRepository.Add(bookmark); return(bookmark); }
public async Task <IActionResult> CreateBookmark([FromBody] CreateBookmarkModel model) { if (model == null) { return(BadRequest()); } var bookmark = new Bookmark { PostID = model.PostID, UserID = model.UserID }; var result = await _BookmarkRepository.Add(bookmark); return(Json(Ok(result))); }
public string CreateOrDeleteBookmark(int postId) { var myUser = _userRepository.Where(p => p.Username == HttpContext.Current.User.Identity.Name).Single(); if (!myUser.Bookmarks.Any(p => p.postId == postId)) { _bookmarkRepository.Add(new Bookmark { postId = postId, userId = myUser.Id }); return("toastr.success('مطلب نشانه گذاری شد .')"); } else { var bookmark = myUser.Bookmarks.FirstOrDefault(p => p.postId == postId); _bookmarkRepository.Delete(bookmark); return("toastr.success('مطلب از لیست نشانه گذاری ها حذف شد .')"); } }
public IActionResult ToggleBookmark([FromBody] IDRequest request) { var response = new BaseResponse <bool>(); var control = bookMarkRepo.FirstOrDefaultBy(x => x.UserID == CurrentUserID && x.RecipeID == request.Id); if (control != null) { bookMarkRepo.Delete(control); } else { bookMarkRepo.Add(new Bookmark { UserID = CurrentUserID, RecipeID = request.Id }); response.Data = true; } return(Ok(response)); }
public async Task <ActionResult <Bookmark> > Add(DataForRegistrationDto dataForRegistration) { var excelId = int.Parse(this.User.Claims.First(i => i.Type == "user_id").Value); return(Ok(await _repo.Add(excelId, dataForRegistration.EventId))); }
public Bookmark AddBookmark(Bookmark bookmark) { return(_bookmarkRepository.Add(bookmark)); }