示例#1
0
        public async Task <IActionResult> CreateCommentAsync([FromBody] TaskCommentDetailRequest request)
        {
            try
            {
                var blRequestMapped = _mapper.Map <TaskCommentDetailRequest, BlTaskCommentDetailRequest>(request);
                await _businessLogic.CreateCommentAsync(blRequestMapped);

                return(Ok(request));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#2
0
        public static void CreateComment(string baseUrl, TaskCommentDetailRequest request)
        {
            try
            {
                _client = new RestClient(baseUrl);
                var apiRequest = new RestRequest(Method.POST)
                {
                    Resource      = "/api/TaskApi/CreateCommentAsync",
                    RequestFormat = DataFormat.Json
                };
                apiRequest.AddBody(request);

                var response = _client.Execute(apiRequest);
                //var data = JsonConvert.DeserializeObject<TaskListResponseDetail>(response.Content);

                //return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
示例#3
0
 public IActionResult CreateComment([FromBody] TaskCommentDetailRequest requestComment)
 {
     TaskAPI.CreateComment($"http://{Request.Host}", requestComment);
     return(Ok(requestComment));
 }