Exemple #1
0
 public void UpdateUser(User user)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.Entry(user).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemple #2
0
 public void AddExperience(Experience experience)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.Experiences.Add(experience);
         ctx.SaveChanges();
     }
 }
Exemple #3
0
 public void AddSkillName(SkillName skillName)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.SkillNames.Add(skillName);
         ctx.SaveChanges();
     }
 }
Exemple #4
0
 public void AddSkill(Skill skill)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.Skills.Add(skill);
         ctx.SaveChanges();
     }
 }
Exemple #5
0
 public void UpdateEducation(Education education)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.Entry(education).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemple #6
0
 public void AddEducation(Education education)
 {
     using (var ctx = new PlatineContext())
     {
         ctx.Educations.Add(education);
         ctx.SaveChanges();
     }
 }
Exemple #7
0
 public void DeleteEducation(Guid id)
 {
     using (var ctx = new PlatineContext())
     {
         var query = ctx.Educations.SingleOrDefault(e => e.Id.Equals(id));
         ctx.Educations.Remove(query);
         ctx.SaveChanges();
     }
 }
Exemple #8
0
        public void UpdateExperience(Experience experience, Guid userId)
        {
            using (var ctx = new PlatineContext())
            {
                if (!experience.UserId.Equals(userId))
                {
                    throw new NotAllowedException();
                }

                ctx.Entry(experience).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
        }
Exemple #9
0
 public void Register(User user)
 {
     using (var ctx = new PlatineContext())
     {
         var query = ctx.Users.SingleOrDefault(u => u.Login.Equals(user.Login));
         if (query != null)
         {
             throw new AlreadyExistException();
         }
         ctx.Users.Add(user);
         ctx.SaveChanges();
     };
 }
Exemple #10
0
 public void DeleteUserById(Guid id)
 {
     using (var ctx = new PlatineContext())
     {
         User u = ctx.Users.SingleOrDefault(e => e.Id.Equals(id));
         if (u == null)
         {
             throw new MissingException("User " + id);
         }
         ctx.Users.Remove(u);
         ctx.SaveChanges();
     }
 }
Exemple #11
0
 public void DeleteExperience(Guid id, Guid userId)
 {
     using (var ctx = new PlatineContext())
     {
         var query = ctx.Experiences.SingleOrDefault(e => e.Id.Equals(id));
         if (query == null)
         {
             throw new MissingException("Experience");
         }
         if (!query.UserId.Equals(userId))
         {
             throw new NotAllowedException();
         }
         ctx.Experiences.Remove(query);
         ctx.SaveChanges();
     }
 }