コード例 #1
0
        public async Task <IActionResult> Create([FromForm] CustomerUserModel user)
        {
            var userName = $"{user.CustomerUserName.Trim()}@{user.CustomerName.Trim()}";

            CustomerUser customerUser = null;

            if (this.ModelState.IsValid && userName.IsValidEmail())
            {
                // Only add user if it is the same domain name
                if (this.User.Identity.Name.GetDomainNameFromEmail()
                    == userName.GetDomainNameFromEmail())
                {
                    customerUser = new CustomerUser
                    {
                        UserName     = userName,
                        CreatedDate  = DateTimeOffset.UtcNow,
                        Id           = Guid.NewGuid(),
                        CustomerName = this.User.Identity.Name.GetDomainNameFromEmail()
                    };

                    // Only the admin can land here, and admin's name is the email.
                    // We assume the customer name is  the email domain
                    _ = await this.customerManagementStore.AddUserAsync(customerUser);

                    return(this.RedirectToAction(nameof(this.Index)));
                }
            }

            this.ModelState.AddModelError("Username", "User name is not a valid email.");
            return(this.View(customerUser));
        }
コード例 #2
0
        public async Task <ActionResult> UsersCreate(RegisterCustomerUserViewModel model)
        {
            if ((ModelState.IsValid) && model.CustomerID > 0)
            {
                CustomerUser user = (CustomerUser)model.GetUser();
                user.CustomerID = model.CustomerID;

                var result = await userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var resultRole = userManager.AddToRole(user.Id, "CustomerRole");
                    userManager.AddToRole(user.Id, "CustomerAdminRole");

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    //string code = await userManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    //await userManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
                    await workflowMessageService.SendUserRegistrationMessageAsync(userManager, user.Id, Request.Url.Scheme, Url);

                    return(RedirectToAction("Users", "Customers", new { id = model.CustomerID }));
                }
                else
                {
                    var errors = string.Join(",", result.Errors);
                    ModelState.AddModelError(string.Empty, errors);
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            UserId.AssertNotEmpty(nameof(UserId));
            RoleId.AssertNotEmpty(nameof(RoleId));

            CustomerUser user = GetUserById(CustomerId, UserId);

            try
            {
                UserMember newMember = new UserMember()
                {
                    UserPrincipalName = user.UserPrincipalName,
                    DisplayName       = user.DisplayName,
                    Id = user.Id
                };

                Partner.Customers[CustomerId].DirectoryRoles[RoleId].UserMembers.Create(newMember);
                WriteObject(true);
            }
            catch (PSPartnerException ex)
            {
                throw new PSPartnerException($"Error adding user {UserId} to role {RoleId}", ex);
            }
            finally
            {
                user = null;
            }
        }
コード例 #4
0
        public void Register(RegisterCustomerBindingModel model)
        {
            var customer = new CustomerUser
            {
                UserName      = model.Email,
                Email         = model.Email,
                Orders        = new List <Order>(),
                UserAddresses = new List <UserAddress>()
                {
                    new UserAddress()
                    {
                        FirstName    = model.PrimaryAddress.FirstName,
                        LastName     = model.PrimaryAddress.LastName,
                        Phone        = model.PrimaryAddress.Phone,
                        AddressLine1 = model.PrimaryAddress.AddressLine1,
                        AddressLine2 = model.PrimaryAddress.AddressLine2,
                        City         = model.PrimaryAddress.City,
                        State        = model.PrimaryAddress.State,
                        Zipcode      = model.PrimaryAddress.Zipcode
                    }
                }
            };

            _userManager.Create(customer, model.Password);
        }
コード例 #5
0
 private CustomerUserDTO Map(CustomerUser dbCustomer)
 {
     return(dbCustomer != null ? new CustomerUserDTO()
     {
         Id = dbCustomer.Id,
         UserName = dbCustomer.UserName,
         Email = dbCustomer.Email,
         Orders = (from order in dbCustomer.Orders
                   select new OrderDTO()
         {
             Id = order.Id,
             ServiceName = order.ServiceName,
             OrderDate = order.OrderDate,
             CompletionDate = order.CompletionDate,
             Price = order.Price,
             ServiceQuality = order.ServiceQuality,
             IsApproved = order.IsApproved,
             IsCompleted = order.IsCompleted
         }).ToList(),
         UserAddresses = (from useraddress in dbCustomer.UserAddresses
                          select new UserAddressDTO()
         {
             FirstName = useraddress.FirstName,
             LastName = useraddress.LastName,
             Phone = useraddress.Phone,
             AddressLine1 = useraddress.AddressLine1,
             AddressLine2 = useraddress.AddressLine2,
             City = useraddress.City,
             State = useraddress.State,
             Zipcode = useraddress.Zipcode
         }).ToList()
     } : null);
 }
コード例 #6
0
 public ActionResult Register(CustomerUser model)
 {
     if (ModelState.IsValid)
     {
         var dao = new CustomerDAO();
         if (dao.CheckUserName(model.TenDN))
         {
             ModelState.AddModelError("", "Tên đăng nhập đã tồn tại");
         }
         else if (dao.CheckEmail(model.Email))
         {
             ModelState.AddModelError("", "Email đã tồn tại");
         }
         else
         {
             model.MatKhau = MaHoa.Instance.Encrypt(model.MatKhau);
             SetGender(model.GioiTinh);
             var result = dao.Insert(model);
             if (result)
             {
                 return(Redirect("/dang-ky-thanh-cong"));
             }
             else
             {
                 ModelState.AddModelError("", "Đăng ký không thành công.");
             }
         }
     }
     SetGender(model.GioiTinh); //  set giá trị
     return(View(model));
 }
コード例 #7
0
 // Allow Initialization with an instance of ApplicationUser:
 public EditCustomerUserViewModel(CustomerUser user)
 {
     this.UserName  = user.UserName;
     this.FirstName = user.FirstName;
     this.LastName  = user.LastName;
     this.Email     = user.Email;
 }
コード例 #8
0
 public bool Post([FromBody] CustomerUser c)
 {
     using (var db = DBConnection.GetConnection())
     {
         return(CustomerUser.Persist <CustomerUser>(db, c));
     }
 }
コード例 #9
0
 public bool Delete(CustomerUser c)
 {
     using (var db = DBConnection.GetConnection())
     {
         return(CustomerUser.Delete <CustomerUser>(db, c));
     }
 }
コード例 #10
0
 public IEnumerable <CustomerUser> Get()
 {
     using (var db = DBConnection.GetConnection())
     {
         return(CustomerUser.GetAll <CustomerUser>(db));
     }
 }
コード例 #11
0
 public CustomerUser Get(int id)
 {
     using (var db = DBConnection.GetConnection())
     {
         return(CustomerUser.GetById <CustomerUser>(db, id));
     }
 }
コード例 #12
0
ファイル: CustomerRL.cs プロジェクト: sonalkarle/Bookstore
        public bool ResetCustomerAccountPassword(ResetPasswordModel resetPasswordModel)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    using (connection)
                    {
                        connection.Open();
                        SqlCommand cmd = new SqlCommand("ChangeCustomerPassword", connection)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        cmd.Parameters.AddWithValue("Email", resetPasswordModel.Email);
                        cmd.Parameters.AddWithValue("NewPassword", Password.ConvertToEncrypt(resetPasswordModel.NewPassword));
                        var returnParameter = cmd.Parameters.Add("@Result", SqlDbType.Int);
                        returnParameter.Direction = ParameterDirection.ReturnValue;

                        CustomerUser  customer = new CustomerUser();
                        SqlDataReader rd       = cmd.ExecuteReader();
                        var           result   = returnParameter.Value;

                        if (result != null && result.Equals(1))
                        {
                            return(true);
                        }
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #13
0
ファイル: CustomerRL.cs プロジェクト: sonalkarle/Bookstore
        public string CreateToken(CustomerUser info)
        {
            try
            {
                var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"]));
                var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
                var claims      = new List <Claim>
                {
                    new Claim(ClaimTypes.Role, "User"),

                    new Claim("Email", info.Email.ToString()),

                    new Claim("CustomerID", info.CustomerID.ToString()),
                };

                var token = new JwtSecurityToken(Configuration["Jwt:Issuer"],
                                                 Configuration["Jwt:Issuer"],
                                                 claims,
                                                 expires: DateTime.Now.AddMinutes(120),
                                                 signingCredentials: credentials);

                return(new JwtSecurityTokenHandler().WriteToken(token));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #14
0
        private static void InitCustomers(AppDbContext db)
        {
            if (db.Customers.Any())
            {
                return;
            }

            var customer = new Customer
            {
                Name    = "Test customer",
                Phone   = "3453463463",
                Address = "test address"
            };

            db.Customers.Add(customer);

            var user = new CustomerUser
            {
                Email    = "*****@*****.**",
                Name     = "First customer user",
                Phone    = "345345345",
                Title    = "Editor",
                Customer = customer
            };

            db.CustomerUsers.Add(user);
            customer.CustomerUsers.Add(user);
            db.SaveChanges();
        }
コード例 #15
0
        public async Task <IActionResult> Edit(Guid id, [Bind("UserName,CustomerName,CreatedDate,Id")]
                                               CustomerUser customerUser)
        {
            if (id != customerUser.Id)
            {
                return(this.NotFound());
            }

            if (this.ModelState.IsValid)
            {
                try
                {
                    await this.customerManagementStore.UpdateCustomerUserAsync(customerUser);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await this.CustomerUserExists(customerUser.UserName))
                    {
                        return(this.NotFound());
                    }

                    throw;
                }

                return(this.RedirectToAction(nameof(this.Index)));
            }

            return(this.View(customerUser));
        }
コード例 #16
0
        public HttpResponseMessage CustomerUserPost(CustomerUser customerUser)
        {
            DbContextTransaction transaction = entities.Database.BeginTransaction();

            try
            {
                Customer customer = new Customer();
                customer.name = customerUser.Name;
                customer.age  = customerUser.Age;
                entities.Customers.Add(customer);
                entities.SaveChanges();

                tblUser user = new tblUser();
                user.userid   = customerUser.Name;
                user.password = customerUser.Password;
                user.role     = customerUser.Role;
                entities.tblUsers.Add(user);
                entities.SaveChanges();

                transaction.Commit();
            }
            catch (Exception)
            {
                transaction.Rollback();
                return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, "Could not Insert into the table"));
            }
            return(Request.CreateResponse(HttpStatusCode.Created, customerUser));
        }
コード例 #17
0
        public async Task <IActionResult> OnPostAsync()
        {
            var user = await _userManager.GetUserAsync(User);

            var userRole = await _userManager.GetRolesAsync(user);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
            }

            if (!ModelState.IsValid)
            {
                await LoadAsync(user);

                return(Page());
            }

            if (userRole[0] == RoleNames.Customer)
            {
                CustomerUser customerUser = (CustomerUser)await _userManager.GetUserAsync(User);

                customerUser.Website       = Input.CustomerUser.Website;
                customerUser.CompanyAddres = Input.CustomerUser.CompanyAddres;
                customerUser.CompanyName   = Input.CustomerUser.CompanyName;
                customerUser.KVK_Number    = Input.CustomerUser.KVK_Number;
                customerUser.BTW_Number    = Input.CustomerUser.BTW_Number;

                var result = await _userManager.UpdateAsync(customerUser);
            }
            else if (userRole[0] == RoleNames.Model)
            {
                ModelUser modelUser = (ModelUser)await _userManager.GetUserAsync(User);

                modelUser.Age       = Input.ModelUser.Age;
                modelUser.Height    = Input.ModelUser.Height;
                modelUser.Chest     = Input.ModelUser.Chest;
                modelUser.LegLength = Input.ModelUser.LegLength;

                var result = await _userManager.UpdateAsync(modelUser);
            }

            var phoneNumber = await _userManager.GetPhoneNumberAsync(user);

            if (Input.PhoneNumber != phoneNumber)
            {
                var setPhoneResult = await _userManager.SetPhoneNumberAsync(user, Input.PhoneNumber);

                if (!setPhoneResult.Succeeded)
                {
                    StatusMessage = "Unexpected error when trying to set phone number.";
                    return(RedirectToPage());
                }
            }

            await _signInManager.RefreshSignInAsync(user);

            StatusMessage = "Your profile has been updated";
            return(RedirectToPage());
        }
コード例 #18
0
        /// <summary>
        /// Restores the specified customer user id.
        /// </summary>
        /// <param name="customerId">Identifier of the customer.</param>
        /// <param name="userId">Identifier of the user.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="customerId"/> is empty or null.
        /// </exception>
        private void RestoreUserById(string customerId, string userId)
        {
            customerId.AssertNotEmpty(nameof(customerId));
            userId.AssertNotEmpty(nameof(userId));

            CustomerUser updatedCustomerUser = new CustomerUser
            {
                State = UserState.Active
            };

            try
            {
                Partner.Customers.ById(customerId).Users.ById(userId).Patch(updatedCustomerUser);
                WriteObject(true);
            }
            catch (PartnerException ex)
            {
                throw new PSPartnerException("Error restoring user id: " + userId, ex);
            }
            finally
            {
                customerId = null;
                userId     = null;
            }
        }
コード例 #19
0
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            Scheduler.RunTask(async() =>
            {
                if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.NewPartnerCustomerUserWhatIf, UserPrincipalName)))
                {
                    IPartner partner = await PartnerSession.Instance.ClientFactory.CreatePartnerOperationsAsync(CorrelationId, CancellationToken).ConfigureAwait(false);
                    CustomerUser newUser;
                    string country;

                    country = (string.IsNullOrEmpty(UsageLocation)) ? PartnerSession.Instance.Context.CountryCode : UsageLocation;
                    string stringPassword = SecureStringExtensions.ConvertToString(Password);

                    newUser = new CustomerUser
                    {
                        PasswordProfile = new PasswordProfile()
                        {
                            ForceChangePassword = ForceChangePassword.IsPresent,
                            Password            = stringPassword
                        },
                        DisplayName       = DisplayName,
                        FirstName         = FirstName,
                        LastName          = LastName,
                        UsageLocation     = country,
                        UserPrincipalName = UserPrincipalName
                    };
                    CustomerUser createdUser = await partner.Customers[CustomerId].Users.CreateAsync(newUser, CancellationToken).ConfigureAwait(false);
                    WriteObject(new PSCustomerUser(createdUser));
                }
            }, true);
        }
コード例 #20
0
        private static CustomerUser CreateCustomerUser(IAggregatePartner partner, Customer existingCustomer, string userName)
        {
            string existingCustomerId = existingCustomer.Id;
            var    userToCreate       = new CustomerUser()
            {
                PasswordProfile = new PasswordProfile()
                {
                    ForceChangePassword = true,
                    Password            = "******"
                },
                DisplayName       = "Thiago",
                FirstName         = "Thiago",
                LastName          = "Nogueira",
                UsageLocation     = "US",
                UserPrincipalName = userName + "@" + existingCustomer.CompanyProfile.Domain
            };

            CustomerUser createdCustomerUser = partner.Customers
                                               .ById(existingCustomerId).Users
                                               .Create(userToCreate);

            Helpers.WriteObject(createdCustomerUser, "Created Customer User");

            return(createdCustomerUser);
        }
コード例 #21
0
        public static void AddDataInCustomerUsers(CustomerUser item)
        {
            CustomerUser CU = new CustomerUser();

            try
            {
                using (FacilitiesEntities _dbContext = new FacilitiesEntities())
                {
                    var RoleId = _dbContext.Roles.Where(a => a.RoleName == "Customer Admin" && a.ActiveFlag == "Y").FirstOrDefault();

                    if (RoleId != null)
                    {
                        CU.CustomerUserId = Guid.NewGuid();
                        CU.Customer       = item.Customer;
                        CU.Role           = RoleId.RoleId;
                        CU.User           = item.User;
                        CU.ActiveFlag     = "Y";
                        _dbContext.CustomerUsers.Add(CU);
                        _dbContext.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
コード例 #22
0
        public async Task RestoreOffice365UserAsync(string office365UserId, string office365CustomerId)
        {
            var requestSuccess = false;
            var attempts       = 1;

            do
            {
                try
                {
                    var updatedCustomerUser = new CustomerUser
                    {
                        State = UserState.Active
                    };

                    await _partnerOperations.UserPartnerOperations.Customers.ById(office365CustomerId)
                    .Users.ById(office365UserId).PatchAsync(updatedCustomerUser);

                    await ConfirmUserRestore(office365CustomerId, office365UserId);

                    requestSuccess = true;
                }
                catch (Exception ex)
                {
                    this.Log().Error($"Create Office 365 User request failed! Attampt: {attempts}", ex);
                    attempts++;
                    await Task.Delay(3000);
                }
            } while (!requestSuccess && attempts < _retryAttempts);

            if (!requestSuccess)
            {
                throw new Exception("Could not restore Office 365 user!");
            }
        }
コード例 #23
0
        [HttpPost("Register")]                                                                    //Creating a Post Api
        public IActionResult RegisterDetails(RegisterCustomer registration)                       //Here return type represents the result of an action method
        {
            try
            {
                if (ModelState.IsValid)
                {
                    CustomerUser result = this.bookBL.RegisterDetails(registration);                   //getting the data from BusinessLayer
                    if (result != null)
                    {
                        return(this.Ok(new { Success = true, Message = "Register details is added Successfully" }));   //(smd format)    //this.Ok returns the data in json format
                    }
                    else
                    {
                        return(this.BadRequest(new { Success = false, Message = "Register details is added  Unsuccessfully" }));
                    }
                }

                else
                {
                    throw new Exception("Model is not valid");
                }
            }


            catch (Exception e)
            {
                return(this.BadRequest(new { Success = false, Message = e.Message }));
            }
        }
コード例 #24
0
        public void AddUserAccount(UserSignUpView user)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                //User Table
                User U = new User();
                U.Username = user.Username;
                U.Password = user.Password;
                db.Users.Add(U);
                db.SaveChanges();

                //UserProfile Table
                UserProfile UP = new UserProfile();
                UP.UserID    = U.UserID;
                UP.FirstName = user.FirstName;
                UP.LastName  = user.LastName;
                UP.Gender    = user.Gender;
                UP.BirthDate = user.BirthDate;
                UP.Mobile    = user.Mobile;
                UP.Email     = user.Email;
                UP.RoleID    = 3;
                db.UserProfiles.Add(UP);
                db.SaveChanges();

                CustomerUser CU = new CustomerUser();
                CU.UserID = U.UserID;
                CU.Active = true;
                db.CustomerUsers.Add(CU);
                db.SaveChanges();
            }
        }
コード例 #25
0
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            CustomerUser newUser;
            string       country;

            CustomerId.AssertNotEmpty(nameof(CustomerId));

            if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.NewPartnerCustomerUserWhatIf, UserPrincipalName)))
            {
                country = (string.IsNullOrEmpty(UsageLocation)) ? PartnerSession.Instance.Context.CountryCode : UsageLocation;
                string stringPassword = SecureStringExtensions.ConvertToString(Password);

                newUser = new CustomerUser
                {
                    PasswordProfile = new PasswordProfile()
                    {
                        ForceChangePassword = ForceChangePassword.IsPresent,
                        Password            = stringPassword
                    },
                    DisplayName       = DisplayName,
                    FirstName         = FirstName,
                    LastName          = LastName,
                    UsageLocation     = country,
                    UserPrincipalName = UserPrincipalName
                };
                CustomerUser createdUser = Partner.Customers[CustomerId].Users.CreateAsync(newUser).GetAwaiter().GetResult();
                WriteObject(new PSCustomerUser(createdUser));
            }
        }
コード例 #26
0
ファイル: UserController.cs プロジェクト: TanaSoftware/TanaDb
        public CustomerObjWrapper GetCustomers(CustomerUser id)

        {
            UserManager userManager = new UserManager();

            return(userManager.GetCustomersPerUser(id));
        }
コード例 #27
0
ファイル: UserServiceTest.cs プロジェクト: ipetk0v/InvenioQD
        public void GetAllCustomerFromDb()
        {
            // Arange
            var userService = new UsersService(db);

            var firstCustomer = new CustomerUser {
                Id = "0", FullName = "BHTC"
            };
            var secondCustomer = new CustomerUser {
                Id = "1", FullName = "FischerTech"
            };
            var thirdCustomer = new CustomerUser {
                Id = "2", FullName = "InnoTape"
            };

            db.CustomerUser.AddRange(firstCustomer, secondCustomer, thirdCustomer);
            db.SaveChanges();

            // Act
            var result = userService.AllCustomer();

            // Assert
            var expectedCount = 3;

            Assert.Equal(expectedCount, result.Count());
        }
コード例 #28
0
        public HttpResponseMessage Get(int something, [FromBody] int anything)
        {
            CustomerUser user = new CustomerUser();

            user.Id  = something;
            user.Age = anything;
            return(Request.CreateResponse <CustomerUser>(HttpStatusCode.OK, user));
        }
コード例 #29
0
        public async Task <SolutionManagerOperationResult> ProvisionSubscriptionWithAdminAsync(string userName,
                                                                                               CustomerRegionEnum?customerRegion,
                                                                                               string fullName,
                                                                                               Guid planId,
                                                                                               Guid subscrptionId)
        {
            var customer = new Customer
            {
                Id           = Guid.NewGuid(),
                Users        = new List <CustomerUser>(),
                CustomerName = userName.GetDomainNameFromEmail()
            };

            var customerUser = new CustomerUser
            {
                Id             = Guid.NewGuid(),
                UserName       = userName,
                CustomerName   = userName.GetDomainNameFromEmail(),
                CustomerRegion = customerRegion,
                FullName       = fullName
            };

            customer.Users.Add(customerUser);

            // We are Contoso's commerce engine part, we simply create a new subscription.
            // We distinguish the Contoso or Azure Marketplace subscription with the SKU
            var subscription = new Subscription
            {
                CustomerId        = customer.Id,
                Customer          = customer,
                SkuId             = planId,
                State             = SubscriptionState.Complete,
                SubscriptionId    = subscrptionId,
                SubscriptionName  = userName.GetDomainNameFromEmail(),
                LastOperationTime = DateTimeOffset.UtcNow,
                CreatedTime       = DateTimeOffset.UtcNow
            };

            var existingSubscription =
                await this.context.CustomerSubscriptions.FirstOrDefaultAsync(s =>
                                                                             s.CustomerId == subscription.CustomerId);

            if (existingSubscription != default)
            {
                // Sample limitation, a customer can only have one subscription
                return(SolutionManagerOperationResult.Failed(
                           new SolutionManagementError {
                    Description = "A customer can have one subscription only."
                }));
            }

            await this.context.CustomerSubscriptions.AddAsync(subscription);

            await this.context.SaveChangesAsync();

            return(SolutionManagerOperationResult.Success);
        }
コード例 #30
0
        public async Task <SolutionManagerOperationResult> DeleteCustomerUserAsync(
            CustomerUser customerUser,
            CancellationToken cancellationToken)
        {
            this.context.CustomerUsers.Remove(customerUser);
            await this.context.SaveChangesAsync(cancellationToken);

            return(SolutionManagerOperationResult.Success);
        }
コード例 #31
0
 public string SetCustomerUserStatus(Guid userID)
 {
     CustomerUser u = new CustomerUser().Get(userID);
     u.activate();
     return "";
 }
コード例 #32
0
        public ActionResult EditCustomerUser(Guid user_id)
        {
            // edits a particular customer user.
            CustomerUser user = new CustomerUser();
            user = user.Get(user_id);
            ViewBag.user = user;

            return View();
        }
コード例 #33
0
 public string RemoveCustomerUser(Guid userID)
 {
     CustomerUser u = new CustomerUser().Get(userID);
     u.Delete();
     return "";
 }
コード例 #34
0
        public ActionResult ViewUserWebProperties(Guid userID)
        {
            CurtDevDataContext db = new CurtDevDataContext();
            List<WebProperty> webProperties = new List<WebProperty>();
            CustomerUser user = new CustomerUser();
            user = user.Get(userID);

            List<int> listOfWebPropIDs = db.CustUserWebProperties.Where(x => x.userID.Equals(userID)).Select(x => x.webPropID).ToList<int>();

            foreach (int webPropID in listOfWebPropIDs)
            {
                WebProperty webProp = db.WebProperties.Where(x => x.id == webPropID).FirstOrDefault<WebProperty>();
                if (webProp != null)
                {
                    webProperties.Add(webProp);
                }
            }// end foreach
            ViewBag.user = user;
            ViewBag.webProperties = webProperties;
            return View("ViewWebProperties");
        }