private BE.Models.User ToUser(DAL.User userEntity) { BE.Models.User newUser = new BE.Models.User(); newUser.id = userEntity.id; newUser.nombre = userEntity.nombre; newUser.password = userEntity.password; newUser.email = userEntity.email; newUser.apellido = userEntity.apellido; return(newUser); }
private DAL.User ToUserEntity(BE.Models.User user) { DAL.User newUser = new DAL.User(); newUser.id = user.id; newUser.nombre = user.nombre; if (!string.IsNullOrEmpty(user.password)) { newUser.password = EncryptHelper.Encrypt(user.password); } newUser.email = user.email; newUser.apellido = user.apellido; return(newUser); }
public BE.Models.User GetUserById(int id) { try { DAL.User dataUser = new DaoUser().GetUserById(id); BE.Models.User user = null; if (dataUser != null) { user = ToUser(dataUser); } return(user); } catch (Exception e) { throw e; } }
public void InsertUser(BE.Models.User user) { new DaoUser().InsertUser(ToUserEntity(user)); }
public void UpdateUser(BE.Models.User user) { new DaoUser().UpdateUser(ToUserEntity(user)); }