Ejemplo n.º 1
0
        public async Task <IActionResult> OnPostDeletePlane()
        {
            string       PlaneId = "";
            MemoryStream stream  = new MemoryStream();

            Request.Body.CopyTo(stream);
            stream.Position = 0;
            using (StreamReader reader = new StreamReader(stream))
            {
                string requestBody = reader.ReadToEnd();
                if (requestBody.Length > 0)
                {
                    var obj = JsonConvert.DeserializeObject <PlaneDTO>(requestBody);
                    if (obj != null)
                    {
                        await _services.disablePlaneAsync(obj.PlaneId);
                    }
                }
            }
            string mes = "Remove " + PlaneId + " Success!";

            return(new JsonResult(mes));
        }