public override Task <GlobalResponse> DeleteLink(GlobalRequest request, ServerCallContext context) { var result = _linkRepository.DeleteLink(request.Id); return(Task.FromResult(new GlobalResponse { Result = result })); }
public void DeleteLinkTest() { var beforeCount = repo.GetAllLinks().Count; repo.DeleteLink(1); var afterCount = repo.GetAllLinks().Count; Assert.AreEqual(beforeCount - 1, afterCount); }
public async Task <IActionResult> DeleteLink([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var link = await _context.DeleteLink(id); return(Ok(link)); }
public async Task PurgeExpiredLinks() { var links = await _linkRepository.GetExpiredLinksAsync(); if (links != null && links.Count() > 0) { foreach (Links l in links) { await _linkRepository.DeleteLink(l.id); } } }
public void DeleteLink(LinkModel link) { _linkRepository.DeleteLink(link.Id); }
public MutationObject( ILinkRepository linkRepository, IUserRepository userRepository, IVoteRepository voteRepository) { this.Name = "Mutation"; this.Description = "The mutation type, represents all updates we can make to our data."; this.FieldAsync <LinkType, Link>( "createLink", "Create a new link.", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <LinkInputObject> >() { Name = "link", Description = "The link you want to create.", }), resolve: context => { var link = context.GetArgument <Link>("link"); return(linkRepository.AddLink(link)); }); this.FieldAsync <LinkType, Link>( "deleteLink", "Delete an existent link.", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> >() { Name = "id", Description = "The id of the link to delete.", }), resolve: context => linkRepository.DeleteLink(context.GetArgument <int>("id"))); this.FieldAsync <UserType, User>( "createUser", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <UserInputObject> > { Name = "user" } ), resolve: context => { var user = context.GetArgument <User>("user"); return(userRepository.AddUser(user)); }); this.FieldAsync <SigninUserPayloadType, SigninUserPayload>( "signinUser", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <SigninUserInputObject> > { Name = "signinUser" } ), resolve: context => { var signinUser = context.GetArgument <SigninUser>("signinUser"); return(userRepository.SigninUser(signinUser)); }); this.FieldAsync <VoteType, Vote>( "createVote", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "userId" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "linkId" } ), resolve: context => { int userId = context.GetArgument <int>("userId"); int linkId = context.GetArgument <int>("linkId"); return(voteRepository.AddVote(userId, linkId, context.CancellationToken)); }); }
public void Delete(int id) { _linkRepo.DeleteLink(id); }
public IHttpActionResult DeleteLink(Guid id) { _linkRepository.DeleteLink(id); return(Ok()); }
public LinkModel Execute(DeleteLinkArgument argument) { var dbLink = _linkRepository.DeleteLink(argument.LinkId); return(LinkHelper.GenerateLinkModel(dbLink)); }
public IActionResult Delete(Link link) { _linkRepository.DeleteLink(link.Id); return(Redirect("Index")); }
public void DeleteLink(int linkId) { _linkRepository.DeleteLink(linkId); }
public IActionResult Delete(int id) { _linkRepository.DeleteLink(id); return(Ok()); }