Example #1
0
        public UserBO GetUserByUsername(string username)
        {
            UserDO retval = dataContext.GetUserDOByUsername(username);

            if (retval == null)
            {
                return(null);
            }
            return(new UserBO(retval));
        }
Example #2
0
        public UserBO GetUserByID(int _userID)
        {
            UserDO retval = dataContext.GetUserDOByID(_userID);

            if (retval == null)
            {
                return(null);
            }
            return(new UserBO(retval));
        }
Example #3
0
        public int Edit(UserDO model)
        {
            var editData = dbContext.tblUsers.First(x => x.User_id == model.User_id);

            editData.User_id    = model.User_id;
            editData.EmployeeId = model.EmployeeId;
            editData.FirstName  = model.FirstName;
            editData.LastName   = model.LastName;
            return(dbContext.SaveChanges());
        }
 // Constructor to map a DataAccessLayer object to a BusinessLogicLayer object
 public UserBO(UserDO _userdo)
 {
     UserID       = _userdo.UserID;
     FirstName    = _userdo.FirstName;
     LastName     = _userdo.LastName;
     UserName     = _userdo.UserName;
     Password     = _userdo.Password;
     EmailAddress = _userdo.EmailAddress;
     RoleID_FK    = _userdo.RoleID_FK;
 }
Example #5
0
        public int Add(UserDO model)
        {
            var data = dbContext.tblUsers.Add(new tblUser()
            {
                EmployeeId = model.EmployeeId,
                FirstName  = model.FirstName,
                LastName   = model.LastName
            });

            return(dbContext.SaveChanges());
        }
Example #6
0
        public UserDO GetById(int id)
        {
            var data = dbContext.tblUsers.FirstOrDefault(x => x.User_id == id);
            var user = new UserDO()
            {
                User_id    = data.User_id,
                EmployeeId = data.EmployeeId,
                FirstName  = data.FirstName,
                LastName   = data.LastName
            };

            return(user);
        }