public static Dependents Create(int vEmployeeId, string vFirstName, string vLastName, string vRelationship)
        {
            Dependents result = new Dependents();

            result.EmployeeId   = vEmployeeId;
            result.FirstName    = vFirstName;
            result.LastName     = vLastName;
            result.Relationship = vRelationship;

            return(result);
        }
Example #2
0
 // Update Dependents record for a particular employee
 public int UpdateDependent(Dependents dependent)
 {
     try
     {
         dbContextRepository.Entry(dependent).State = EntityState.Modified;
         dbContextRepository.SaveChanges();
         return(1);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         throw;
     }
 }
Example #3
0
 public int AddDependent(Dependents dependent)
 {
     try
     {
         dbContextRepository.Dependents.Add(dependent);
         dbContextRepository.SaveChanges();
         return(1);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         throw;
     }
 }
Example #4
0
 public int DeleteDependent(int id)
 {
     try
     {
         Dependents dependent = dbContextRepository.Dependents.Find(id);
         dbContextRepository.Dependents.Remove(dependent);
         dbContextRepository.SaveChanges();
         return(1);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         throw;
     }
 }