Exemplo n.º 1
0
        public ActionResult <bool> DeleteAdmin(string typename, int id)
        {
            Type type = null;

            try
            {
                type = GetTypeCaseInsensitive($"DatabaseWebService.DatabaseObjects.{typename}");
                if (type == null)
                {
                    throw new Exception($"The requested datatype {typename} doesnt exist.");
                }
                DbSelector.Delete(id, type);

                return(true);
            }
            catch (TargetException)
            {
                var text = type.GetProperties().Aggregate("Supplied a faulty object to the Server. The expected Structure is:\n", (current, prop) => current + $"{prop.Name} : {prop.PropertyType.Name}\n");
                throw new Exception(text);
            }
        }