Пример #1
0
        /// <summary>
        /// Method to delete usersusing the Commands
        /// </summary>
        /// <param name="id">Id of the user</param>
        public void RemoveUser(string id)
        {
            try
            {
                Command <string, bool> CommandRemoveUser;
                CommandRemoveUser = FactoryCommand.GetCommandRemoveUser();

                CommandRemoveUser.Execute(id);
            }
            catch (Exception e)
            {
                Command <Exception, bool> CommandCreateLog;
                CommandCreateLog = FactoryCommand.GetCommandCreateLog();
                CommandCreateLog.Execute(e);
            }
        }
Пример #2
0
        /// <summary>
        /// Method to update users using the Commands
        /// </summary>
        /// <param name="user">User to be updated</param>
        /// <returns>User</returns>
        public User UpdateUser(User user)
        {
            try
            {
                Command <Entity, Entity> CommandUpdateUser;
                CommandUpdateUser = FactoryCommand.GetCommandUpdateUser();

                return((User)CommandUpdateUser.Execute(user));
            }
            catch (Exception e)
            {
                Command <Exception, bool> CommandCreateLog;
                CommandCreateLog = FactoryCommand.GetCommandCreateLog();
                CommandCreateLog.Execute(e);
            }

            return(null);
        }
Пример #3
0
        /// <summary>
        /// Method to get one user using the Commands
        /// </summary>
        /// <param name="id">Id of the user</param>
        /// <returns>User</returns>
        public User GetUser(string id)
        {
            try
            {
                Command <string, Entity> CommandGetUser;
                CommandGetUser = FactoryCommand.GetCommandGetUser();

                return((User)CommandGetUser.Execute(id));
            }
            catch (Exception e)
            {
                Command <Exception, bool> CommandCreateLog;
                CommandCreateLog = FactoryCommand.GetCommandCreateLog();
                CommandCreateLog.Execute(e);
            }

            return(null);
        }
Пример #4
0
        /// <summary>
        /// Method to get all Users using the Commands
        /// </summary>
        /// <returns>List of user</returns>wfc
        public List <User> GetAll()
        {
            try
            {
                Command <bool, List <Entity> > CommandGetAll;
                CommandGetAll = FactoryCommand.GetCommandGetAll();

                return(CommandGetAll.Execute(true).Cast <User>().ToList());
            }
            catch (Exception e)
            {
                Command <Exception, bool> CommandCreateLog;
                CommandCreateLog = FactoryCommand.GetCommandCreateLog();
                CommandCreateLog.Execute(e);
            }

            return(null);
        }