コード例 #1
0
        public async Task <ActionResult> Update(RecruitmentStep recruitmentStep)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseAddress);
                    client.DefaultRequestHeaders.Accept.Clear();
                    var content = new StringContent(JsonConvert.SerializeObject(recruitmentStep),
                                                    Encoding.UTF8, "application/Json");
                    var responseMessage = await client.PostAsync("api/workflow/update", content);

                    responseMessage.EnsureSuccessStatusCode();

                    if (responseMessage.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        TempData["Error"] = ErrorData.GetError(null, false);
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["Error"] = ErrorData.GetError(ex.Message);
            }

            return(View());
        }