public async Task <ActionResult> SearchResult(ShiftIndexViewModel data) { if (data.queries == null) { return(View("Index", data)); } else { var postTask = await client.PostAsJsonAsync("/api/Shift/Search", data); var shift = await postTask.Content.ReadAsAsync <ShiftSearchViewModel>(); return(Json(shift, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> Edit(string comp_id, string sft_id) { if (sft_id != null && comp_id != null) { ShiftUpdateViewModel model = new ShiftUpdateViewModel(); var postTask = await client.GetAsync("/api/Shift/View/?comp_id=" + comp_id + "&sft_id=" + sft_id); model = await postTask.Content.ReadAsAsync <ShiftUpdateViewModel>(); if (model != null) { return(View("Edit", model)); } else { ShiftIndexViewModel data = new ShiftIndexViewModel(); ViewBag.Error = "No Shift Found !"; return(View("Index", data)); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }