public static BugTagsViewModel MapFrom(BugTag d)
 {
     return(new BugTagsViewModel
     {
         ID = d.ID,
         BugID = d.BugID,
         Tag = d.Tag
     });
 }
Exemple #2
0
        static void PrintBug(ref BugTag dbi)

      #region Helper function

        {
            Console.WriteLine("Bug no: {0}", dbi.BugNo);
            Console.WriteLine("Developer: {0}", dbi.Developer);
            Console.WriteLine("Last Reviewed: {0}", dbi.LastReview);
            Console.WriteLine("Remarks: {0}", dbi.Message);
            Console.WriteLine("........................");
        }
        public async Task <IHttpActionResult> Post(BugTag bTag)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.BugTags.Add(bTag);
            await db.SaveChangesAsync();

            return(Ok(BugTagsViewModel.MapFrom(bTag)));
        }
Exemple #4
0
        static void ShowBugsForClass(ref Type classInfo)

      #region iterating through the attribtues of the Rectangle class

        {
            Console.WriteLine();
            Console.WriteLine("Print bugs tagged for Rectangle class");
            Console.WriteLine("=====================================");
            foreach (Object classAttribute in classInfo.GetCustomAttributes(false))
            {
                BugTag dbi = (BugTag)classAttribute;
                if (null != dbi)
                {
                    PrintBug(ref dbi);
                }
            }
        }
Exemple #5
0
        static void ShowBugsForMethods(ref Type classInfo)

      #region  iterating through the method attribtues

        {
            Console.WriteLine();
            Console.WriteLine("Print bugs tagged for each method");
            Console.WriteLine("=====================================");

            foreach (MethodInfo methodInfo in classInfo.GetMethods())
            {
                bool hasCRd = false;
                Console.Write("Method: {0}", methodInfo.Name);
                foreach (Attribute methodAttribute in methodInfo.GetCustomAttributes(true))
                {
                    if (methodAttribute.GetType() == typeof(BugTag))
                    {
                        if (!hasCRd)
                        {
                            Console.WriteLine();
                            hasCRd = true;
                        }
                        Console.WriteLine("........................");
                        BugTag dbi = (BugTag)methodAttribute;
                        PrintBug(ref dbi);
                    }
                    else
                    {
                        if (!hasCRd)
                        {
                            Console.WriteLine("  <<< is a Base member");
                            hasCRd = true;
                        }
                    }
                }
            }
        }
 public static async Task <BugTagsViewModel> MapFromAsync(BugTag d)
 {
     return(await Task.Run(() => { return MapFrom(d); }));
 }