public void CanDeleteSkill()
        {
            //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
            skillRepository.Delete(skillId);

            //Assert
            Assert.AreEqual(0, skillRepository.GetForCv(cvId).Count);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Skill skill = repo.Get(id);

            repo.Delete(skill);
            //db.Skills.Remove(skill);
            //db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
        public async Task DeleteSkillAsync_SkillIsPreviouslySeeded_DeletesSkill()
        {
            SkillTag deleted;

            using (var uow = unitOfWorkProvider.Create())
            {
                repository.Delete(Initializer.JavaSkill.Id);
                await uow.Commit();

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

            Assert.Null(deleted);
        }
 public IActionResult Delete(int id)
 {
     if ((new[] { "Admin" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
     {
         if (repo.GetOne(id) == null)
         {
             return(NotFound());
         }
         else
         {
             repo.Delete(id);
             return(Ok());
         }
     }
     else
     {
         return(Unauthorized());
     }
 }
Example #5
0
 public void Delete(int skillId)
 {
     _skillRepository.Delete(skillId);
     _skillListStale = true;
 }