public ActionResult UpdateProjectStatus(UpdateProjectStatusModel model) { PopulateStatusList(); ViewBag.Class = "alert-danger"; ViewBag.Message = "Error Occurred"; try { if (ModelState.IsValid) { var serialized = new JavaScriptSerializer().Serialize(model); var client = new HttpClient(); var content = new StringContent(serialized, System.Text.Encoding.UTF8, "application/json"); client.BaseAddress = new Uri(HttpContext.Request.Url.AbsoluteUri); var Clientresult = client.PostAsync(BaseURL + "/api/Project/UpdateProjectStatus", content).Result; if (Clientresult.StatusCode == HttpStatusCode.OK) { ViewBag.Class = "alert-success"; ViewBag.Message = "Updated Successfully"; var contents = Clientresult.Content.ReadAsStringAsync().Result; var response = new JavaScriptSerializer().Deserialize <ResponseModel>(contents); ModelState.Clear(); } } } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View()); }
public ActionResult UpdateProjectStatus(long ProjectId = 0) { PopulateStatusList(); ViewBag.Class = "display-hide"; if (ProjectId > 0) { UpdateProjectStatusModel model = new UpdateProjectStatusModel() { ProjectId = ProjectId }; return(View(model)); } return(View()); }