예제 #1
0
        public bool NeededSkillCreate(NeededSkillCreate model)
        {
            var newNeededSkill = new NeededSkill()
            {
                Skill     = model.Skill,
                ProjectId = model.ProjectId
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.NeededSkills.Add(newNeededSkill);
                return(ctx.SaveChanges() == 1);
            }
        }
예제 #2
0
        // NeededSkills
        public static List <NeededSkillCreate> NeededSkillsDummyData()
        {
            List <NeededSkillCreate> neededSkills = new List <NeededSkillCreate>();

            var skill     = new string[] { "Navigation skills", "Rowing skills", "Seamanship", "Singing", "Drumming", "Piano Skills", "Guitar skills", "Espionage", "Spy skills", "Software development skills", "Web development skills", "Tea making", "Tea drinking" };
            var projectId = new int[] { 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5 };

            for (int i = 0; i < skill.Length; i++)
            {
                var neededSkill = new NeededSkillCreate()
                {
                    Skill     = skill[i],
                    ProjectId = projectId[i]
                };

                neededSkills.Add(neededSkill);
            }

            return(neededSkills);
        }
예제 #3
0
        public IHttpActionResult Post(NeededSkillCreate neededSkill)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = Service();

            if (!service.NeededSkillCreate(neededSkill))
            {
                return(InternalServerError());
            }

            string newLog     = "Skill Created";
            var    logService = CreateLogService();

            logService.LogCreate(newLog);

            return(Ok(newLog));
        }