public async Task <ActionResult> Update(EmployeeClassUpdateViewModel data) { if (ModelState.IsValid) { try { data.modifiedDateTime = DateTime.Now; data.modifiedBy = Session["user_id"].ToString(); var postTask = await client.PostAsJsonAsync("/api/EmployeeClass/Update", data); if (postTask.IsSuccessStatusCode) { return(Json(true, JsonRequestBehavior.DenyGet)); } } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.DenyGet)); } } return(Json(false, JsonRequestBehavior.DenyGet)); }
public async Task <ActionResult> Edit(string comp_id, string class_id) { if (class_id != null && comp_id != null) { EmployeeClassUpdateViewModel model = new EmployeeClassUpdateViewModel(); var postTask = await client.GetAsync("/api/EmployeeClass/View/?comp_id=" + comp_id + "&class_id=" + class_id); model = await postTask.Content.ReadAsAsync <EmployeeClassUpdateViewModel>(); if (model != null) { return(View("Edit", model)); } else { EmployeeClassIndexViewModel data = new EmployeeClassIndexViewModel(); ViewBag.Error = "No Employee Class Found !"; return(View("Index", data)); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }