Ejemplo n.º 1
0
        private IItem GetItem(IDatabase p_Database,
                              string p_Path)
        {
            // TODO : Coder ça moins croche
            string[]      path           = p_Path.Split('/');
            string        p_CurrentPath  = path[0];
            IItem         parentItem     = p_Database.GetItem(p_CurrentPath);
            ITemplateItem folderTemplate = p_Database.GetTemplate(UserSynchronizerConstants.FOLDER_TEMPLATE_ID);

            for (int i = 1; i < path.Count(); i++)
            {
                p_CurrentPath = p_CurrentPath + '/' + path[i];
                IItem currentItem = p_Database.GetItem(p_CurrentPath);
                if (currentItem == null)
                {
                    currentItem = parentItem.AddItem(path[i], folderTemplate);
                }
                parentItem = currentItem;
            }

            return(p_Database.GetItem(p_Path));
        }
Ejemplo n.º 2
0
        public IActionResult AddProductItem(ProductItemViewModel model)
        {
            var    userId   = HttpContext.Request.Cookies["user_id"];
            string imageurl = UploadedFile(model.Image);

            ViewBag.categories = _MasterService.GetCategories().Select(s => new CategoryDto
            {
                Id           = s.Id,
                CatogeryName = s.CatogeryName
            });
            var result = _ProductItem.AddItem(new ItemDto
            {
                Name        = model.Name,
                CatogeryId  = model.CatogeryId,
                Discription = model.Discription,
                Image       = imageurl,
                Price       = model.Price,
                Quantity    = model.Quantity,
                SellerId    = userId,
            });

            ViewBag.msg = result.Message;
            return(View());
        }
Ejemplo n.º 3
0
 public void Drop(IItem item)
 {
     _ground.AddItem(item);
 }
Ejemplo n.º 4
0
        public void CreateUserItem(IUser p_User,
                                   IItem p_ParentItem,
                                   ITemplateItem p_Template,
                                   IDatabase p_Database)
        {
            IItem item = p_Database.GetItem(Path + "/" + Domain + "/" + p_User.Name) ?? p_ParentItem.AddItem(p_User.Name, p_Template);

            RunEditFieldPipeline(item, p_User);
        }