Exemplo n.º 1
0
 public bool UpdateStudent(StudentDTO student)
 {
     try
     {
         var entity = _mapper.Map <Student>(student);
         _studentContext.Set <Student>().Attach(entity);
         _studentContext.Entry(entity).State = EntityState.Modified;
         _studentContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogError(ex.Message);
         return(false);
     }
 }
Exemplo n.º 2
0
 public StudentRepository(StudentContext context)
 {
     _context = context;
     entities = context.Set <T>();
 }