public async Task <IActionResult> Delete(int id)

    {
        await _subscriptionService.Delete(id);

        return(Ok(new { Success = true }));
    }
Example #2
0
        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."));
        }
Example #3
0
 public IHttpActionResult Delete(string id)
 {
     try
     {
         return(Ok(_subscriptionService.Delete(id)));
     }
     catch (Exception e)
     {
         return(GetExceptionResponse(e));
     }
 }
Example #4
0
        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());
            }
        }
Example #6
0
        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());
        }
Example #7
0
        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));
        }
Example #8
0
        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")
                           ));
            }
                );
        }
Example #9
0
 public IHttpActionResult DeleteSubscriptionsByIds([FromUri] string[] ids)
 {
     _subscriptionService.Delete(ids);
     return(StatusCode(HttpStatusCode.NoContent));
 }
 public IActionResult Delete(Guid id)
 {
     _service.Delete(id);
     return(Ok());
 }
Example #11
0
        public IActionResult Delete(int id)
        {
            var subscriptionResult = subscriptionService.Delete(id);

            return(StatusCode((int)subscriptionResult.Status, true));
        }