Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
 public LocationAddView(LocationAddViewModel locationAddViewModel)
 {
     this.DataContext = locationAddViewModel;
     this.InitializeComponent();
 }
Esempio n. 3
0
 public async Task <JsonResult> checkLocationIfExist(LocationAddViewModel data)
 {
     return(await checkLocation(data.comp_id, data.loc_id)
         ? Json(true, JsonRequestBehavior.AllowGet)
         : Json(false, JsonRequestBehavior.AllowGet));
 }
Esempio n. 4
0
        public ActionResult Add()
        {
            LocationAddViewModel model = new LocationAddViewModel();

            return(View("Add", model));
        }