public string UpdateAssgnActSec(AssgnSecProdList sModels) { var model = new KickOffMeetingModel(); string resT = model.UpdateAssgnSecPro(sModels); return(resT); //return Json(resT, JsonRequestBehavior.AllowGet); }
public string UpdateAssgnSecPro(AssgnSecProdList sObj) { string value = null; using (var httpClient = new HttpClient()) { var url = ConfigurationManager.AppSettings["WEBAPIURL"]; httpClient.BaseAddress = new Uri(url); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", HttpContext.Current.Session["token"].ToString()); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); List <Object> sList = new List <Object>(); var nObj = new { ProDoc_Section_Assignment_id = sObj.pro_doc_section_assignment_id, User_id = sObj.user_id.user_id, Last_Modified_By = HttpContext.Current.Session["UserID"].ToString(), Last_Modified_Date = DateTime.Now.ToString("dd/MMM/yyyy HH:mm:ss") }; sList.Add(nObj); var responseTask = httpClient.PutAsJsonAsync("Product/ReassignSecAssign", sList); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { using (HttpContent content = result.Content) { Task <string> result1 = content.ReadAsStringAsync(); var rs = result1.Result; dynamic data = JsonConvert.DeserializeObject(rs); value = Convert.ToString(data); if (value.Contains("error")) { Warning = true; IsSuccess = false; Message = data.error; // InsertAudit("Reassign user for section", Message, "Failed"); } else if (value.Contains("warning")) { Warning = true; IsSuccess = false; Message = data.warning; // InsertAudit("Reassign user for section", Message, "Failed"); } else { IsSuccess = true; Message = data.info; getAssSecByProIdList = GetAssignedSectionbyProDocIdList(pro_doc_id); // InsertAudit("Reassign user for section", Message, "Success"); return(value); } } } } return(value); }