Ejemplo n.º 1
0
 protected override void Save()
 {
     using (var db = new GameDatabaseContext())
     {
         var ContentTemplate = this.ContentTemplate as SkillTemplate;
         var repository = new SkillRepository(db);
         repository.Update(ContentTemplate, ContentTemplate.Id);
     }
     base.Save();
 }
Ejemplo n.º 2
0
        public ActionResult PatchSkill(PatchSkillDto patchSkillDto)
        {
            if (patchSkillDto == null)
            {
                throw new ArgumentNullException(nameof(patchSkillDto));
            }

            skillRepository.Update(patchSkillDto.PatchedByUsername, patchSkillDto.SkillId, patchSkillDto.LevelId, patchSkillDto.Summary);
            return(Ok());
        }
Ejemplo n.º 3
0
        public IHttpActionResult SaveSkill(SkillTemplate skillTemplate, int id)
        {
            using (var context = new GameDatabaseContext())
            {

                var repo = new SkillRepository(context);
                repo.Update(skillTemplate, id);

                return Ok();
            }
        }
Ejemplo n.º 4
0
        public async Task UpdateUserAsync_UserIsPreviouslySeeded_UpdatesUser()
        {
            SkillTag updatedSkill;
            SkillTag newSkill;

            using (var uow = unitOfWorkProvider.Create())
            {
                newSkill = new SkillTag
                {
                    Id   = Initializer.JavaSkill.Id,
                    Name = "Java Super Hero"
                };

                repository.Update(newSkill);
                await uow.Commit();

                updatedSkill = await repository.GetAsync(Initializer.JavaSkill.Id);
            }

            Assert.IsTrue(newSkill.Name.Equals(updatedSkill.Name));
        }
Ejemplo n.º 5
0
 public IActionResult Put(int id, SkillModel Skill)
 {
     if ((new[] { "Admin" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
     {
         if (repo.GetOne(id) == null)
         {
             return(NotFound());
         }
         else if (Skill == null || Skill.NameEN == null || Skill.NameFR == null || Skill.Classe.Id == 0)
         {
             return(BadRequest());
         }
         else
         {
             repo.Update(id, Skill.ToEntity());
             return(Ok());
         }
     }
     else
     {
         return(Unauthorized());
     }
 }
        public void CanUpdateSkill()
        {
            //Arrange
            var context         = GetSqlLiteContext();
            var cvRepository    = new CvRepository(context);
            var skillRepository = new SkillRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId  = cvRepository.Get()[0].Id;
            var skill = new Skill()
            {
                Name = "Continuous Delivery", Blurb = "Awesome at CI and CD"
            };

            skillRepository.AddToCv(skill, cvId);
            var skillId = skillRepository.GetForCv(cvId)[0].Id;

            //Act
            var skillUpdate = new Skill()
            {
                Id = skillId, Name = "C#", Blurb = "Been using it since 2001."
            };

            skillRepository.Update(skillUpdate);

            //Assert
            var result = skillRepository.Get(skillId);

            Assert.AreEqual(skillUpdate.Name, result.Name);
            Assert.AreEqual(skillUpdate.Blurb, result.Blurb);
            Assert.AreEqual(cvId, result.Cv.Id);
        }
Ejemplo n.º 7
0
 [System.Web.Mvc.HttpPost] public void Update(Skill skill)
 {
     SkillRepository.Update(skill);
 }
Ejemplo n.º 8
0
 public void Update(Skill skill)
 {
     _skillRepository.Update(skill);
     _skillListStale = true;
 }