public ResultEntity <UserAdministratorEntity> Update(UserAdministratorEntity useradministratorEntity)
        {
            var validationResult = new ResultEntity <UserAdministratorEntity>();

            //useradministratorEntity.Password = UtilityHelper.PasswordHash(useradministratorEntity.Password);

            using (var useradministratorDA = new UserAdministratorDA())
            {
                var userAdminList = useradministratorDA.GetByUserName(useradministratorEntity.UserName);

                var linq = (from x in userAdminList
                            where x.ID != useradministratorEntity.ID
                            select x).ToList <UserAdministratorEntity>();

                if (linq.Count() > 0)
                {
                    validationResult.Warning.Add("Username " + useradministratorEntity.UserName + " already exist");
                    return(validationResult);
                }

                var isOldPassword = useradministratorDA.CheckPassword(useradministratorEntity.ID, useradministratorEntity.Password);

                if (isOldPassword == null)
                {
                    useradministratorEntity.Password = UtilityHelper.PasswordHash(useradministratorEntity.Password);
                }

                var resultUpdate = useradministratorDA.Update(useradministratorEntity);

                if (resultUpdate <= 0)
                {
                    validationResult.Warning.Add("Failed Updating UserAdministrator!");
                    return(validationResult);
                }

                validationResult.Value = useradministratorEntity;
            }

            return(validationResult);
        }
        public ResultEntity <UserAdministratorEntity> Create(UserAdministratorEntity useradministratorEntity)
        {
            var validationResult = new ResultEntity <UserAdministratorEntity>();

            useradministratorEntity.Password = UtilityHelper.PasswordHash(useradministratorEntity.Password);

            using (var useradministratorDA = new UserAdministratorDA())
            {
                var userAdminList = useradministratorDA.GetByUserName(useradministratorEntity.UserName);

                if (userAdminList.Count() > 0)
                {
                    validationResult.Warning.Add("Username " + useradministratorEntity.UserName + " already exist");
                    return(validationResult);
                }

                useradministratorEntity.CreatedDate = DateTime.Now;
                validationResult.Value = useradministratorDA.Create(useradministratorEntity);
            }

            return(validationResult);
        }