public async Task <ActionResult> Add(DocumentNumberAddViewModel data) { if (ModelState.IsValid) { try { data.active = true; data.createdDateTime = DateTime.Now; data.createdBy = Session["user_id"].ToString(); var postTask = await client.PostAsJsonAsync("/api/DocumentNumber/Add", data); 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() { DocumentNumberAddViewModel data = new DocumentNumberAddViewModel(); return(View("Add", data)); }