Пример #1
0
        public string GetTargets()
        {
            DataAbstractionLayer dal = new DataAbstractionLayer();

            if (Request.Params.AllKeys.Contains("TargetID"))
            {
                bool isValidId = Int32.TryParse(Request.Params["TargetID"], out int targetID);
                if (isValidId)
                {
                    Target target = dal.GetTargetById(targetID);
                    if (target != null)
                    {
                        return(TargetToHtml(target));
                    }
                    return("<h3>No target with the given ID...</h3>");
                }
                return("<h3>Target ID is not valid!</h3>");
            }
            List <Target> targets = dal.GetTargets();

            return(TargetsToTable(targets));
        }