public async Task <ActionResult> Add(LocationAddViewModel model) { if (ModelState.IsValid) { try { model.active = true; model.createdDatetime = DateTime.Now; model.createdBy = Session["user_id"].ToString(); var postTask = await client.PostAsJsonAsync("/api/Location/Add", model); if (postTask.IsSuccessStatusCode) { return(RedirectToAction("Index", "Location")); } } catch (Exception e) { ViewBag.Error = e.Message; return(View("Add")); } } return(RedirectToActionPermanent("Index")); }
public LocationAddView(LocationAddViewModel locationAddViewModel) { this.DataContext = locationAddViewModel; this.InitializeComponent(); }
public async Task <JsonResult> checkLocationIfExist(LocationAddViewModel data) { return(await checkLocation(data.comp_id, data.loc_id) ? Json(true, JsonRequestBehavior.AllowGet) : Json(false, JsonRequestBehavior.AllowGet)); }
public ActionResult Add() { LocationAddViewModel model = new LocationAddViewModel(); return(View("Add", model)); }