Exemplo n.º 1
0
        public JsonResult Get(string name, string?id)
        {
            try
            {
                if (id == "all")
                {
                    return(Json(Getobject(name)));
                }

                Type tp = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(t => t.Name == name);
                if (tp == null)
                {
                    throw new Exception();
                }

                return(Json(db.Find(tp, Convert.ToInt32(id))));
            }
            catch
            {
                return(Json(null));
            }
        }