Exemplo n.º 1
0
 public int AddTech(SkillDtl newEntry)
 {
     try
     {
         db.SkillDtls.Add(newEntry);
         db.SaveChanges();
         return(1);
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                               eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Value: \"{1}\", Error: \"{2}\"",
                                   ve.PropertyName,
                                   eve.Entry.CurrentValues.GetValue <object>(ve.PropertyName),
                                   ve.ErrorMessage);
             }
         }
         throw;
     }
 }
Exemplo n.º 2
0
        public void Delete()
        {
            user.DeleteSkills(30);
            SkillDtl user2 = user.skillById1(30);

            Assert.IsNull(user2);
        }
Exemplo n.º 3
0
        public UserInfo AddNewSkill(SkillDtl skillDtl)
        {
            try
            {
                string   message        = null;
                SkillDtl duplicateCheck = data.SkillDtls.SingleOrDefault(x => x.name == skillDtl.name);
                if (duplicateCheck == null)
                {
                    data.SkillDtls.Add(skillDtl);
                    data.SaveChanges();
                    message = "added successfully";
                }
                else
                {
                    message = "Already exists in data";
                }

                return(new UserInfo()
                {
                    message = message
                });
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public void getSkillById()
        {
            user     user = new user();
            SkillDtl p    = user.getSkillById(1);

            Assert.IsNotNull(p);
        }
Exemplo n.º 5
0
        public int DeleteSkills(int id)
        {
            SkillDtl emp = db.SkillDtls.Find(id);

            db.SkillDtls.Remove(emp);
            db.SaveChanges();
            return(1);
        }
Exemplo n.º 6
0
        public void delete()
        {
            user user = new user();

            user.DeleteSkillById(1);
            SkillDtl sk = user.getSkillById(1);

            Assert.IsTrue(sk == null);
        }
Exemplo n.º 7
0
        public void Delete()
        {
            UL user = new UL();

            user.DeleteEmployee(3);
            SkillDtl user2 = user.skillById1(3);

            Assert.IsNull(user2);
        }
Exemplo n.º 8
0
 public void AddNewSkill(SkillDtl skillDtl)
 {
     try
     {
         data.SkillDtls.Add(skillDtl);
         data.SaveChanges();
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 9
0
 public void saveSkill(SkillDtl skill)
 {
     try
     {
         db.SkillDtls.Add(skill);
         db.SaveChanges();
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 10
0
 public void EditSkill(SkillDtl skillDtl)
 {
     try
     {
         data.Entry(skillDtl).State = EntityState.Modified;
         data.Configuration.ValidateOnSaveEnabled = false;
         data.SaveChanges();
         data.Configuration.ValidateOnSaveEnabled = true;
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 11
0
 public int DeleteEmployee(int id)
 {
     try
     {
         SkillDtl emp = db.SkillDtls.Find(id);
         db.SkillDtls.Remove(emp);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 12
0
 public void updateskill(SkillDtl skill)
 {
     try
     {
         SkillDtl skillDtl = data.SkillDtls.Find(skill.id);
         skillDtl.toc               = skill.toc;
         skillDtl.prerequisites     = skill.prerequisites;
         skillDtl.fees              = skill.fees;
         data.Entry(skillDtl).State = EntityState.Modified;
         data.Configuration.ValidateOnSaveEnabled = false;
         data.SaveChanges();
         data.Configuration.ValidateOnSaveEnabled = true;
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 13
0
        public int UpdateSkills(int id, SkillDtl skill)
        {
            SkillDtl emp = db.SkillDtls.Find(id);

            if (emp != null)
            {
                try
                {
                    emp.name          = skill.name;
                    emp.toc           = skill.toc;
                    emp.prerequisites = skill.prerequisites;
                    emp.fees          = skill.fees;
                    db.SaveChanges();
                }
                catch
                {
                    throw;
                }
            }
            return(1);
        }
Exemplo n.º 14
0
 public IHttpActionResult editSkillById(int id, SkillDtl skill)
 {
     ctrl.editSkillById(id, skill);
     return(Ok("updated"));
 }
Exemplo n.º 15
0
 public IHttpActionResult saveSkill(SkillDtl skill)
 {
     ctrl.saveSkill(skill);
     return(Ok("Technology Added"));
 }
Exemplo n.º 16
0
 public IHttpActionResult AddSkill(SkillDtl skillDtl)
 {
     userLogic.AddNewSkill(skillDtl);
     return(Ok("Request Sent"));
 }
Exemplo n.º 17
0
 public int EditSkill(int id, SkillDtl skill)
 {
     return(userlogic.UpdateSkills(id, skill));
 }
Exemplo n.º 18
0
 public int AddTechnology(SkillDtl details)
 {
     return(userlogic.AddTech(details));
 }
Exemplo n.º 19
0
 public IHttpActionResult updateskill(SkillDtl skill)
 {
     userLogic.updateskill(skill);
     return(Ok("Updated Sucessfully"));
 }
Exemplo n.º 20
0
        public IHttpActionResult AddSkill(SkillDtl skillDtl)
        {
            var result = userLogic.AddNewSkill(skillDtl);

            return(Ok(result));
        }