public async Task <ResponseResult> UpdateDebugRawData(AddDebugRawDataViewModel model) { ResponseResult responseResult = new ResponseResult(); StringContent content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync("api/debug/UpdateDebugRawData", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); responseResult = JsonConvert.DeserializeObject <ResponseResult>(apiResponse); } return(responseResult); }
public async Task <IActionResult> UpdateDebugRawData([FromBody] AddDebugRawDataViewModel model) { try { await context.Database.ExecuteSqlCommandAsync(SPDebug.DebugRawData_update, model.Wc, model.MonthID, model.WorkingDayPerMonth, model.WorkingHourPerShift, model.ShiftPatten, model.WorkEfficiency, model.ForecastedVolume, model.UpdateBy, model.Coverage); return(Ok(new ResponseResult(200))); } catch (Exception ex) { return(BadRequest(new ResponseResult(400, ex.Message))); } }
public async Task <IActionResult> AddDebugRawData(AddDebugRawDataViewModel model) { if (ModelState.IsValid) { var result = await debugService.AddDebugRawData(model); if (result.StatusCode == 200) { //return Redirect("/debug/search"); return(Redirect("http://vnhcmm0teapp02/hcs")); } else { foreach (var item in result.Notification) { ModelState.AddModelError("", item); } var WCs = await debugService.GetAllAsync(); ViewData["WCs"] = WCs; var userId = User.Identity.Name; var id = userId.Split("\\"); ViewData["Id"] = id[1]; var displayName = FindName(id[1]); ViewData["displayName"] = displayName; return(View(model)); } } else { var WCs = await debugService.GetAllAsync(); ViewData["WCs"] = WCs; var userId = User.Identity.Name; var id = userId.Split("\\"); ViewData["Id"] = id[1]; var displayName = FindName(id[1]); ViewData["displayName"] = displayName; return(View(model)); } }
public async Task <IActionResult> UpdateDebugRawData([FromBody] AddDebugRawDataViewModel model) { var result = await debugService.UpdateDebugRawData(model); return(Json(new { statusCode = result.StatusCode })); }