Example #1
0
        public Developer Edit(Guid developerId, string name, string email, string webSite, string paypalLogin)
        {
            BaseSecurity.EnsureSysAdminOrCurrentUser(developerId, Context);

            var user     = ServiceLocator.UserService.GetById(developerId);
            var oldEmail = user.Login;

            user.Login = email;
            var developer = GetById(developerId);

            developer.Name        = name;
            developer.WebSite     = webSite;
            developer.PayPalLogin = paypalLogin;
            DoUpdate(u =>
            {
                var usda = new UserDataAccess(u);
                if (oldEmail != email && usda.GetUser(email, null, null) != null)
                {
                    throw new ChalkableException("User email already exists");
                }
                new DeveloperDataAccess(u).Update(developer);
                usda.Update(user);
                if (oldEmail != email)
                {
                    ServiceLocator.EmailService.SendChangeEmailToDeveloper(developer, oldEmail, email);
                }
            });
            developer.User = user;
            return(developer);
        }
Example #2
0
        public Developer ChangePayPalLogin(Guid developerId, string paypalLogin)
        {
            BaseSecurity.EnsureSysAdminOrCurrentUser(developerId, Context);
            var developer = GetById(developerId);

            developer.PayPalLogin = paypalLogin;
            DoUpdate(u => new DeveloperDataAccess(u).Update(developer));
            return(developer);
        }