public virtual ActionResult Submit(InventoryGroupViewModel model)
        {
            LogI("Submit");
            CallMessagesResultVoid result = new CallMessagesResultVoid();

            var messages = model.Validate();

            if (!messages.Any())
            {
                result = InventoryGroupViewModel.Apply(Db,
                                                       ActionService,
                                                       model,
                                                       Time.GetAmazonNowTime(),
                                                       AccessManager.UserId);
            }
            else
            {
                result = new CallMessagesResultVoid()
                {
                    Messages = messages,
                    Status   = CallStatus.Fail
                };
            }

            return(Json(new UpdateRowViewModel(model, "InventoryGroupList", null, false)));
        }
        public virtual ActionResult EditGroup(long id)
        {
            LogI("EditGorup, groupId=" + id);

            var model = InventoryGroupViewModel.GetWithItems(Db, id);

            ViewBag.PartialViewName = PopupContentView;
            return(View("EditEmpty", model));
        }
        public virtual ActionResult AddFeed()
        {
            LogI("AddFeed");

            var model = new InventoryGroupViewModel();

            ViewBag.PartialViewName = PopupContentView;
            return(View("EditEmpty", model));
        }
        public virtual ActionResult DeleteGroup(int id)
        {
            LogI("DeleteGroup, id=" + id);

            InventoryGroupViewModel.Remove(Db,
                                           LogService,
                                           id);


            return(Json(MessageResult.Success(), JsonRequestBehavior.AllowGet));
        }
        public virtual ActionResult AddGroup(IList <long> styleIds)
        {
            LogI("AddGroup: " + string.Join(",", styleIds));

            var model = InventoryGroupViewModel.BuildFrom(Db, styleIds);

            ViewBag.PartialViewName = PopupContentView;
            return(View("EditEmpty", model));

            //return View("EditEmpty", model);
        }
        public virtual ActionResult GetChildren([DataSourceRequest] DataSourceRequest request, int Id)
        {
            LogI("GetChildren, id=" + Id);

            var items      = InventoryGroupViewModel.GetChildItems(Db, Id).ToList();
            var dataSource = items.ToDataSourceResult(request);

            return(new JsonResult {
                Data = dataSource, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public virtual ActionResult GetAll([DataSourceRequest] DataSourceRequest request,
                                           DateTime?dateFrom,
                                           DateTime?dateTo)
        {
            LogI("GetAll, "
                 + ", dateFrom=" + dateFrom
                 + ", dateTo=" + dateTo);

            var searchFilter = new InventoryGroupFilterViewModel()
            {
                DateFrom = dateFrom,
                DateTo   = dateTo,
            };
            var items      = InventoryGroupViewModel.GetAll(Db, Time, searchFilter);
            var dataSource = items.ToDataSourceResult(request);

            return(Json(dataSource, JsonRequestBehavior.AllowGet));
        }