Ejemplo n.º 1
0
 public IActionResult DeleteSkill(int id)
 {
     var skill = ctx.Skills.FirstOrDefault(sk => sk.id == id);
     if (skill != null)
     {
         ctx.Remove(skill);
         ctx.SaveChanges();
     }
     return Ok();
 }
        public IActionResult Post([FromBody] Demo m)
        {
            if (m.id == 0)
            {
                ctx.Demos.Add(m);
            }
            else
            {
                ctx.Demos.Attach(m);
                ctx.Entry(m).State = EntityState.Modified;
            }

            ctx.SaveChanges();
            return(Ok());
        }
Ejemplo n.º 3
0
        public IActionResult Post([FromBody] Skill m)
        {
            if (m.Id == 0)
            {
                ctx.Skills.Add(m);
            }
            else
            {
                ctx.Skills.Attach(m);
                ctx.Entry(m).State = EntityState.Modified;
            }

            ctx.SaveChanges();
            NotifyChange();
            return(Ok());
        }
Ejemplo n.º 4
0
        public static void Initialize(SkillDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Skills.FirstOrDefault() == null)
            {
                var sk1 = new Skill {
                    name = "node.js"
                };
                var sk2 = new Skill {
                    name = "typescript"
                };

                context.Skills.AddRange(sk1, sk2);

                context.SaveChanges();
            }
        }
        public static void Initialize(SkillDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Topics.FirstOrDefault() == null)
            {
                var t1 = new Topic {
                    title = "Theming"
                };
                var t2 = new Topic {
                    title = "RxJS"
                };

                context.Topics.AddRange(t1, t2);

                var sk1 = new Skill {
                    title = "Custom Theme", completed = true, hours = 4, duedate = DateTime.Now.AddMonths(-1), topicId = t1.id
                };
                var sk2 = new Skill {
                    title = "Theme Mixins", completed = false, hours = 3, duedate = DateTime.Now.AddMonths(-2), topicId = t1.id
                };
                var sk3 = new Skill {
                    title = "Light & Dark Theme", completed = false, hours = 2, duedate = DateTime.Now.AddMonths(2), topicId = t1.id
                };
                var sk4 = new Skill {
                    title = "RxJS Operators", completed = true, hours = 5, duedate = DateTime.Now.AddDays(2), topicId = t2.id
                };
                var sk5 = new Skill {
                    title = "Custom Operators", completed = false, hours = 1, duedate = DateTime.Now.AddYears(1), topicId = t2.id
                };

                context.Skills.AddRange(sk1, sk2, sk3, sk4, sk5);

                var d1 = new Demo {
                    topicId = 1, title = "Last Demo", url = "last", component = "last"
                };
                context.Demos.Add(d1);

                context.SaveChanges();
            }
        }
Ejemplo n.º 6
0
        public static void Initialize(SkillDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Topics.FirstOrDefault() == null)
            {
                var t1 = new Topic {
                    id = 1, title = "Cloud"
                };
                var t2 = new Topic {
                    id = 2, title = "Angular"
                };

                context.Topics.AddRange(t1, t2);

                var sk1 = new Skill {
                    Title = "Azure CLI", Completed = true, Hours = 4, DueDate = DateTime.Now.AddMonths(-1)
                };
                var sk2 = new Skill {
                    Title = "Microsoft Identity", Completed = false, Hours = 3, DueDate = DateTime.Now.AddMonths(-2)
                };
                var sk3 = new Skill {
                    Title = ".NET Core", Completed = false, Hours = 2, DueDate = DateTime.Now.AddMonths(2)
                };
                var sk4 = new Skill {
                    Title = "Microsoft Graph", Completed = true, Hours = 5, DueDate = DateTime.Now.AddDays(2)
                };
                var sk5 = new Skill {
                    Title = "Azure DevOps", Completed = false, Hours = 1, DueDate = DateTime.Now.AddYears(1)
                };

                context.Skills.AddRange(sk1, sk2, sk3, sk4, sk5);

                context.SaveChanges();
            }
        }
Ejemplo n.º 7
0
        public static void Initialize(SkillDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Topics.FirstOrDefault() == null)
            {
                var t1 = new Topic {
                    id = 1, title = "Theming"
                };
                var t2 = new Topic {
                    id = 2, title = "RxJS"
                };

                context.Topics.AddRange(t1, t2);

                var sk1 = new Skill {
                    Title = "Custom Theme", Completed = true, Hours = 4, DueDate = DateTime.Now.AddMonths(-1)
                };
                var sk2 = new Skill {
                    Title = "Theme Mixins", Completed = false, Hours = 3, DueDate = DateTime.Now.AddMonths(-2)
                };
                var sk3 = new Skill {
                    Title = "Light & Dark Theme", Completed = false, Hours = 2, DueDate = DateTime.Now.AddMonths(2)
                };
                var sk4 = new Skill {
                    Title = "RxJS Operators", Completed = true, Hours = 5, DueDate = DateTime.Now.AddDays(2)
                };
                var sk5 = new Skill {
                    Title = "Custom Operators", Completed = false, Hours = 1, DueDate = DateTime.Now.AddYears(1)
                };

                context.Skills.AddRange(sk1, sk2, sk3, sk4, sk5);

                context.SaveChanges();
            }
        }