public async Task <IActionResult> Delete(int id) { await _subscriptionService.Delete(id); return(Ok(new { Success = true })); }
public IActionResult Delete(string subscriptionId) { if (subscriptionId == null) { return(BadRequest("SubscriptionId must not be null")); } int result = _subscription.Delete(subscriptionId); if (result == 0) { return(BadRequest("Faulthy Subscription info.")); } if (result == 1) { return(NotFound("Subscription not found")); } return(Ok("Subscription is deleted.")); }
public IHttpActionResult Delete(string id) { try { return(Ok(_subscriptionService.Delete(id))); } catch (Exception e) { return(GetExceptionResponse(e)); } }
partial void AddBuildingFields(ISubscriptionService <Building> subscriptionService) { FieldAsync <MutationResponseType <Building, BuildingType> >( "addBuilding", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <GuidGraphType> > { Name = "gamesessionId" }, new QueryArgument <NonNullGraphType <BuildingInputType> > { Name = "building" } ), resolve: async context => { var building = context.GetArgument <Building>("building"); var gamesessionId = context.GetArgument <Guid>("gamesessionId"); building.Id = Guid.NewGuid(); building.GamesessionIds.Add(gamesessionId); return(await subscriptionService.Add(building)); } ); FieldAsync <MutationResponseType <Building, BuildingType> >( "updateBuilding", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <BuildingInputType> > { Name = "building" } ), resolve: async context => { return(await subscriptionService.Update( context.GetArgument <Building>("building") )); } ); FieldAsync <MutationResponseType <Building, BuildingType> >( "deleteBuilding", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <GuidGraphType> > { Name = "id" } ), resolve: async context => { return(await subscriptionService.Delete( context.GetArgument <Guid>("id") )); } ); }
public async Task <ActionResult> Delete(Guid id, IFormCollection collection) { try { await _subscriptionService.Delete(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task Subscribe(string topic) { var subscription = await _subscriptionService.Get(Context.ConnectionId); if (subscription != null) { await Groups.RemoveFromGroupAsync(Context.ConnectionId, subscription.Topic); await _subscriptionService.Delete(Context.ConnectionId); } await _subscriptionService.Add(new Subscription { Topic = topic, SubscriptionId = Context.ConnectionId }); await Groups.AddToGroupAsync(Context.ConnectionId, topic); var messages = await _messageService.GetByTopicName(topic); await Clients.Caller.SendAsync("connect", messages.ToJson()); }
public async Task <IActionResult> Delete(int id) { var subscription = await _subscriptionService.Get(id); await _subscriptionService.Delete(id); var viewModel = new SubscriptionListViewModel() { VirtualAccountId = subscription.VirtualAccountId, Subscriptions = await _subscriptionService.GetAll(subscription.VirtualAccountId) }; return(PartialView("_SubscriptionList", viewModel)); }
partial void AddGamesessionFields( ISubscriptionService <Gamesession> subscriptionService, IAlternativesRepository <Inheritance> inheritancesRepository, IAlternativesRepository <Road> roadsRepository, IAlternativesRepository <Livingcondition> livingconditionsRepository ) { FieldAsync <MutationResponseType <Gamesession, GamesessionType> >( "addGamesession", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "userId" } ), resolve: async context => { var userId = context.GetArgument <string>("userId"); var gamesession = new Gamesession { OwnerId = userId }; gamesession.UserIds.Add(userId); //gamesession.Roads = await roadsRepository.GetAsync(gamesession.Id); //gamesession.Inheritances = await inheritancesRepository.GetAsync(gamesession.Id); //gamesession.Livingconditions = await livingconditionsRepository.GetAsync(gamesession.Id); return(await subscriptionService.Add(gamesession)); } ); FieldAsync <MutationResponseType <Gamesession, GamesessionType> >( "updateGamesession", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <GamesessionInputType> > { Name = "gamesession" } ), resolve: async context => { return(await subscriptionService.Update( context.GetArgument <Gamesession>("gamesession") )); } ); FieldAsync <MutationResponseType <Gamesession, GamesessionType> >( "deleteGamesession", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <GuidGraphType> > { Name = "id" } ), resolve: async context => { return(await subscriptionService.Delete( context.GetArgument <Guid>("id") )); } ); }
public IHttpActionResult DeleteSubscriptionsByIds([FromUri] string[] ids) { _subscriptionService.Delete(ids); return(StatusCode(HttpStatusCode.NoContent)); }
public IActionResult Delete(Guid id) { _service.Delete(id); return(Ok()); }
public IActionResult Delete(int id) { var subscriptionResult = subscriptionService.Delete(id); return(StatusCode((int)subscriptionResult.Status, true)); }