/** * Método para actualizar el registro */ public static void update(users user) { using (var conn = new db_entities()) { try { var entity = conn.users.Where(x => x.id == user.id).FirstOrDefault(); user.updated_at = new DateTime(); if (entity == null) { throw new NotExistsException(); } else { if (user.password == null || user.password == "") { conn.SP_USER_UPDATE_WITHOUT_PASSWORD(user.id, user.name, user.email, user.rol_id, user.unit_id, DateTime.Now, user.state); } else { conn.SP_USER_UPDATE_WITH_PASSWORD(user.id, user.name, user.email, user.password, user.rol_id, user.unit_id, DateTime.Now, user.state); } } } catch (Exception e) { throw e; } } }