Exemplo n.º 1
0
 public ActionResult Store_Create([DataSourceRequest] DataSourceRequest request, StoreViewModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         _storeService.AddStore(BindStore(model));
     }
     return Json(new[] { model }.ToDataSourceResult(request, ModelState));
 }
Exemplo n.º 2
0
 public ActionResult Destroy_Store([DataSourceRequest] DataSourceRequest request, StoreViewModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         var store = _storeService.FindById(model.StoreID);
         _storeService.DeleteStore(store);
     }
     return Json(ModelState.ToDataSourceResult());
 }
Exemplo n.º 3
0
 public ActionResult Store_Update([DataSourceRequest] DataSourceRequest request, StoreViewModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         var origin = _storeService.FindById(model.StoreID);
         origin.Number = model.Number;
         origin.Name = model.Name;
         origin.HubID = model.HubID;
         origin.IsActive = model.IsActive;
         origin.IsTemporary = model.IsTemporary;
         origin.StackCount = model.StackCount;
         origin.StoreManName = model.StoreManName;
         _storeService.EditStore(origin);
     }
     return Json(new[] { model }.ToDataSourceResult(request, ModelState));
 }
Exemplo n.º 4
0
        private Store BindStore(StoreViewModel model)
        {
            if (model == null) return null;
            var store = new Store()
            {
                StoreID = model.StoreID,
                Number = model.Number,
                Name = model.Name,
                HubID = model.HubID,
                IsActive = model.IsActive,
                IsTemporary = model.IsTemporary,
                StackCount = model.StackCount,
                StoreManName = model.StoreManName

            };
            return store;
        }