Exemplo n.º 1
0
        public async Task <IActionResult> Add([FromBody] ServerNodeVM model)
        {
            var requiredResult = CheckRequired(model);

            if (!requiredResult.Item1)
            {
                Response.StatusCode = 400;
                return(Json(new
                {
                    message = requiredResult.Item2
                }));
            }

            var ctrl   = new ServerNodeController(_serverNodeService, _sysLogService, _remoteServerNodeProxy);
            var result = (await ctrl.Add(model)) as JsonResult;

            dynamic obj = result.Value;

            if (obj.success == true)
            {
                return(Created("", ""));
            }

            Response.StatusCode = 400;
            return(Json(new
            {
                obj.message
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete([FromQuery] string address)
        {
            var ctrl   = new ServerNodeController(_serverNodeService, _sysLogService, _remoteServerNodeProxy);
            var result = (await ctrl.Delete(new ServerNodeVM {
                Address = address
            })) as JsonResult;

            dynamic obj = result.Value;

            if (obj.success == true)
            {
                return(NoContent());
            }

            Response.StatusCode = 400;
            return(Json(new
            {
                obj.message
            }));
        }