コード例 #1
0
        private object GetAll(string target)
        {
            try {
                // Create a connection to the PetaPoco ORM and try to fetch and object with the given Id
                NotificationMapper        not_mpr = new NotificationMapper();
                IList <NotificationModel> res     = null;

                // Get all objects or a filtered list by user
                if (target != null)
                {
                    res = not_mpr.GetByTarget(target);
                }
                else
                {
                    res = not_mpr.Get();
                }

                // Convert this into an array of JSON objects.
                return(Response.AsJson(res));
            } catch (Exception e) {
                return(HandleException(e, String.Format("NotificationModule.GetAll()")));
            }
        }