public ActionResult Delete(String id, Resource rs)
        {
            try
            {
                var req = sv.GetMany().Where(a => a.Id == id).FirstOrDefault();

                ResourceHistory rh = new ResourceHistory
                {
                    FirstName = req.FirstName,
                    LastName  = req.LastName,
                    Username  = req.UserName
                };

                sh.Add(rh);
                sh.Commit();

                sv.Delete(req);
                sv.Commit();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        public object DeleteService(InputDeleteService input)
        {
            var serviceSid = input.ServiceSid;

            var result = ServiceResource.Delete(pathSid: serviceSid);

            return(result);
        }
Ejemplo n.º 3
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        ServiceResource.Delete(pathSid: "MG2172dd2db502e20dd981ef0d67850e1a");
    }
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        ServiceResource.Delete(pathSid: "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    }
Ejemplo n.º 5
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            User            u  = new User();
            ServiceResource Sr = new ServiceResource();

            u = Sr.GetById(id);
            Sr.Delete(u);
            Sr.Commit();

            return(RedirectToAction("AllResources"));
        }
Ejemplo n.º 6
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        var accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        var authToken  = "your_auth_token";
        var client     = new TwilioRestClient(accountSid, authToken);

        ServiceResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
        .Execute(client);

        Console.WriteLine("Deleted");
    }
Ejemplo n.º 7
0
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";
        const string serviceSid = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        var status = ServiceResource.Delete(serviceSid);

        Console.WriteLine(status);
    }
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid     = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken      = "your_auth_token";
        const string pathServiceSid = "MG2172dd2db502e20dd981ef0d67850e1a";

        TwilioClient.Init(accountSid, authToken);

        var deleted = ServiceResource.Delete(pathServiceSid);

        Console.WriteLine(deleted);
    }
Ejemplo n.º 9
0
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken  = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string serviceSid = Environment.GetEnvironmentVariable("TWILIO_SERVICE_SID");

        TwilioClient.Init(accountSid, authToken);

        var status = ServiceResource.Delete(serviceSid);

        Console.WriteLine(status);
    }
Ejemplo n.º 10
0
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid     = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken      = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string pathServiceSid = "MG2172dd2db502e20dd981ef0d67850e1a";

        TwilioClient.Init(accountSid, authToken);

        var deleted = ServiceResource.Delete(pathServiceSid);

        Console.WriteLine(deleted);
    }
Ejemplo n.º 11
0
        public void TestDeleteResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.NoContent,
                         "null"
                         ));

            var response = ServiceResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 12
0
        public void TestDeleteRequest()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();
            var request          = new Request(
                HttpMethod.Delete,
                Twilio.Rest.Domain.Chat,
                "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                ""
                );

            twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content"));

            try
            {
                ServiceResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);
                Assert.Fail("Expected TwilioException to be thrown for 500");
            }
            catch (ApiException) {}
            twilioRestClient.Received().Request(request);
        }