Exemple #1
0
        public static Item Get(int id)
        {
            Item       item;
            ItemEntity entity;

            entity = ItemDao.Get(id);
            item   = ItemMapper.Get(entity);

            return(item);
        }
Exemple #2
0
        public static void Update(Item item)
        {
            try
            {
                ItemEntity entity;

                entity = ItemMapper.Get(item);

                ItemDao.Update(entity);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        private object GetAll(string owner)
        {
            try {
                // Create a connection to the PetaPoco ORM and try to fetch and object with the given Id
                ItemMapper        itm_mpr = new ItemMapper();
                IList <ItemModel> res     = null;

                // Get all objects or a filtered list by user
                if (owner != null)
                {
                    res = itm_mpr.GetByOwner(owner);
                }
                else
                {
                    res = itm_mpr.Get();
                }

                // Convert this into an array of JSON objects.
                // string json = JsonConvert.SerializeObject(products, Formatting.Indented);
                return(Response.AsJson(res));
            } catch (Exception e) {
                return(HandleException(e, String.Format("ItemModule.GetAll()")));
            }
        }