Exemplo n.º 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var deletePub = await _pub.Delete(id);

            if (deletePub)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Publish the spacePin.
        /// </summary>
        /// <param name="spacePin">SpacePinASA to publish</param>
        /// <returns>True on success.</returns>
        /// <remarks>
        /// It may be this should be a private member.
        /// </remarks>
        public async Task <bool> Publish(SpacePinASA spacePin)
        {
            if (!IsReady)
            {
                // mafinc - Should we wait until it is ready? Maybe as a binder option?
                return(false);
            }

            int idx = FindSpacePin(spacePin);

            if (idx < 0)
            {
                Debug.LogError($"Trying to publish unknown space pin. Must be added in inspector or AddSpacePin() first.");
                return(false);
            }

            int cloudIdx = FindBindingBySpacePinId(spacePin.SpacePinId);

            if (cloudIdx >= 0)
            {
                SimpleConsole.AddLine(ConsoleHigh, $"Publishing previously published space pin={spacePin.SpacePinId}, deleting from cloud first.");
                await publisher.Delete(bindings[cloudIdx].cloudAnchorId);

                RemoveBinding(spacePin.SpacePinId);
            }

            var obj = ExtractForPublisher(spacePin);

            if (obj == null)
            {
                return(false);
            }
            CloudAnchorId cloudAnchorId = await publisher.Create(obj);

            if (string.IsNullOrEmpty(cloudAnchorId))
            {
                Debug.LogError($"Failed to create cloud anchor for {spacePin.SpacePinId}");
                return(false);
            }
            SetBinding(spacePin.SpacePinId, cloudAnchorId);
            return(true);
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete(int id)
        {
            var deletePublisher = await _publisher.Delete(id);

            if (deletePublisher)
            {
                Alert("Publisher deleted successfully!", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            Alert("Publisher not deleted!", NotificationType.success);
            return(View());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Delete(int id)
        {
            var deletePublisher = await _publisher.Delete(id);

            if (deletePublisher)
            {
                return(Ok("Publisher Deleted"));
            }
            else
            {
                return(BadRequest(new { message = "Unable to delete Publisher details" }));
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Delete(int id)
        {
            var deletePub = await _pub.Delete(id);

            if (deletePub)
            {
                Alert("Publisher Deleted successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Publisher not Deleted!", NotificationType.error);
            }
            return(View());
        }