public async Task <ActionResult> Add(ShiftAddViewModel model) { if (ModelState.IsValid) { try { model.active = true; model.createdBy = Session["user_id"].ToString(); model.createdDatetime = DateTime.Now; var postTask = await client.PostAsJsonAsync("/api/Shift/Add", model); if (postTask.IsSuccessStatusCode) { return(Json(true, JsonRequestBehavior.DenyGet)); } } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.DenyGet)); } } return(Json(false, JsonRequestBehavior.DenyGet)); }
public ActionResult Add() { ShiftAddViewModel model = new ShiftAddViewModel(); return(View("Add", model)); }
public async Task <JsonResult> checkShiftIfExist(ShiftAddViewModel data) { return(await checkShift(data.comp_id, data.sft_Id) ? Json(true, JsonRequestBehavior.AllowGet) : Json(false, JsonRequestBehavior.AllowGet)); }