public bool UpdateUser(int userId, UserDto newUserDetails) { var oldUserDetails = FindUserByUserId(userId); this.user = new User() { UserID = userId, UserName = newUserDetails.UserName.Trim(), Password = oldUserDetails.Password, HashPassword = oldUserDetails.HashPassword, UserTypeID = newUserDetails.UserTypeID, IsActive = oldUserDetails.IsActive, CreatedBy = oldUserDetails.CreatedBy, DateCreated = oldUserDetails.DateCreated, UpdatedBy = newUserDetails.UpdatedBy, DateUpdated = newUserDetails.DateUpdated, BranchID = newUserDetails.BranchId }; if (_user.Update2(this.user).IsNull()) { return(false); } return(true); }
public bool UpdateInactiveUser(int userId, int?updatedBy) { var oldUserDetails = FindUserByUserId(userId); this.user = new User() { UserID = userId, UserName = oldUserDetails.UserName, Password = oldUserDetails.Password, HashPassword = oldUserDetails.HashPassword, UserTypeID = oldUserDetails.UserTypeID, IsActive = oldUserDetails.IsActive ? false : true, CreatedBy = oldUserDetails.CreatedBy, DateCreated = oldUserDetails.DateCreated, UpdatedBy = updatedBy, DateUpdated = System.DateTime.Now, BranchID = oldUserDetails.BranchId }; if (_user.Update2(this.user).IsNull()) { return(false); } return(true); }
public UserService(IIOBalanceRepository <User> user, IIOBalanceRepository <UserType> userType) { this._user = user; this._userType = userType; this.user = new User(); this.userType = new UserType(); }
public bool SaveUser(UserDto dto) { this.user = dto.DtoToEntity(); if (this._user.Insert(user).IsNull()) { return(false); } return(true); }
public static IOBalanceEntity.User DtoToEntity(this UserDto dto) { IOBalanceEntity.User entity = null; if (!dto.IsNull()) { entity = new IOBalanceEntity.User { UserID = 0, UserName = dto.UserName.Trim(), Password = dto.Password, CreatedBy = dto.CreatedBy, DateCreated = dto.DateCreated, DateUpdated = dto.DateUpdated, HashPassword = dto.HashPassword, UserTypeID = dto.UserTypeID, IsActive = true, UpdatedBy = dto.UpdatedBy, BranchID = dto.BranchId }; } return(entity); }