public async Task <IActionResult> PutAsync([FromBody] ClientApi data)
        {
            if (data == null)
            {
                _loger.LogError("Bad request parameter");

                var error = new BadRequest("Parameter is null", new { data });
                return(error.ReturnResponse());
            }

            var id = await _service.PutAsync(data);

            if (id == null)
            {
                _loger.LogError("Duplicate data for client id : " + data.ClientId);

                var error = new Forbidden("Duplicate data for client id : " + data.ClientId, new { data });
                return(error.ReturnResponse());
            }

            var result = new OK("Success update data", new { id });

            return(result.ReturnResponse());
        }
Beispiel #2
0
        public async Task <IActionResult> PostAsync([FromBody] Tasks data)
        {
            if (data == null)
            {
                _loger.LogError("Bad request parameter");

                var error = new BadRequest("Parameter is null", new { data });
                return(error.ReturnResponse());
            }

            var id = await _service.PostAsync(data);

            if (id == null)
            {
                _loger.LogError("Duplicate data for Name : " + data.Name);

                var error = new Forbidden("Duplicate data for Name : " + data.Name, new { data });
                return(error.ReturnResponse());
            }

            var result = new OK("Success add data", new { id });

            return(result.ReturnResponse());
        }