Beispiel #1
0
        public IActionResult EditIntakeRemittance(long id, IntakeRemittance IntakeRemittance)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    IntakeRemittance.State = BusinessEntity.Models.Base.Enums.ObjectState.Active;

                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri("http://localhost:5001/api/IntakeRemittance/");

                        var result = client.PostAsJsonAsync("PUT?id=" + id.ToString(), IntakeRemittance);
                        result.Wait();
                        var res = result.Result;

                        if (res.IsSuccessStatusCode)
                        {
                            var p1 = res.Content.ReadAsStringAsync();
                            var p  = res.Content.ReadAsStringAsync().Result;
                        }
                    }
                }
                return(Json(new { success = true, message = "Ok" }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Beispiel #2
0
        public IActionResult DeleteIntakeRemittance(IntakeRemittance IntakeRemittance)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri("http://localhost:5001/api/IntakeRemittance/");

                    var result = client.PostAsJsonAsync("Delete?id=" + IntakeRemittance.Id.ToString(), IntakeRemittance);
                    result.Wait();
                    var res = result.Result;

                    if (res.IsSuccessStatusCode)
                    {
                        var p1 = res.Content.ReadAsStringAsync();
                        var p  = res.Content.ReadAsStringAsync().Result;
                    }
                }
                return(Json(new { success = true, message = "Ok" }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Beispiel #3
0
        public IActionResult AddIntakeRemittance(IntakeRemittance IntakeRemittance)
        {
            //https://johnthiriet.com/efficient-post-calls/
            if (ModelState.IsValid)
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri("http://localhost:5001/api/IntakeRemittance/");

                    var result = client.PostAsJsonAsync("POST", IntakeRemittance);
                    result.Wait();
                    var res = result.Result;

                    if (res.IsSuccessStatusCode)
                    {
                        var p1 = res.Content.ReadAsStringAsync();
                        var p  = res.Content.ReadAsStringAsync().Result;
                    }
                }
            }
            return(Json(new { success = true, message = "Ok" }));
        }