コード例 #1
0
ファイル: AccountBPL.cs プロジェクト: majurans/ETCCanada
        public async Task<IdentityResult> AddUserAsync(ApplicationUserModel userModel)
        {

            //TODO: Convert HttpPostedFileBase to byte[]
            IdentityResult result = await accountRepo.AddUserAsync(userModel).ConfigureAwait(false);
            return result;


        }
コード例 #2
0
        public async Task<IdentityResult> AddUserAsync(ApplicationUserModel userModel)
        {

            IdentityResult result;
            ApplicationUser appUser = ApplicationUserMapper.ToApplicationUserEntity(userModel);
            result = await IdentityManagers.UserManager.CreateAsync(appUser);

            if (result.Succeeded)
            {
                ApplicationRole role = await IdentityManagers.RoleManager.FindByIdAsync(userModel.RoleId);
                result = await IdentityManagers.UserManager.AddToRoleAsync(appUser.Id, role.Name);
            }

            return result;
        }
コード例 #3
0
 internal static ApplicationUser ToApplicationUserEntity(ApplicationUserModel userModel)
 {
     return new ApplicationUser
     {
         Email = userModel.Email,
         UserName = userModel.Email,
         AddressLine1 = userModel.AddressLine1,
         AddressLine2 = userModel.AddressLine2,
         City = userModel.City,
         Country = userModel.Country,
         DisplayName = userModel.DisplayName,
         FirstName = userModel.FirstName,
         LastName = userModel.LastName,
         Phone = userModel.Phone,
         PostalCode = userModel.PostalCode,
         State = userModel.State,
         FirstNameInTamil = userModel.FirstNameInTamil,
         LastNameInTamil = userModel.LastNameInTamil
     };
 }
コード例 #4
0
        public ActionResult Manage(ApplicationUserModel model)
        {
            ViewBag.StateList = GetStateSelectList();
            ViewBag.CountryList = commonBPL.GetCountrySelectList();
            if (!ModelState.IsValid)
                return View(model);

            bool isUpdated = accountBPL.UpdateUser(model);

            ViewBag.Status = "Success";
            ViewBag.Message = "User details have been updated successfully";
            return View();
        }
コード例 #5
0
        internal bool UpdateUser(ApplicationUserModel model)
        {
            bool isUpdated = false;

            ApplicationUser userEntity = IdentityManagers.UserManager.FindById(model.Id);
            userEntity.AddressLine1 = model.AddressLine1;
            userEntity.AddressLine2 = model.AddressLine2;
            userEntity.City = model.City;
            userEntity.Email = model.Email;
            userEntity.FirstName = model.FirstName;
            userEntity.LastName = model.LastName;
            userEntity.Phone = model.Phone;
            userEntity.PostalCode = model.PostalCode;
            userEntity.UserName = model.Email;
            userEntity.State = model.State;
            userEntity.Country = model.Country;
            userEntity.FirstNameInTamil = model.FirstNameInTamil;
            userEntity.LastNameInTamil = model.LastNameInTamil;
            IdentityManagers.UserManager.Update(userEntity);
            context.SaveChanges();
            isUpdated = true;

            return isUpdated;

        }
コード例 #6
0
ファイル: AccountBPL.cs プロジェクト: majurans/ETCCanada
 internal bool UpdateUser(ApplicationUserModel model)
 {
     return accountRepo.UpdateUser(model);
 }
コード例 #7
0
ファイル: ShareRepository.cs プロジェクト: majurans/ETCCanada
        internal ApplicationUserModel GetUserWithShareHoldingSummary(string userId)
        {
            ApplicationUserModel user = new ApplicationUserModel();
            IEnumerable<ShareEntity> userShares = context.Shares.Where(x => x.PurchasedUserId == userId).OrderByDescending(x => x.PurchasedDateTimeUtc);
            user.TotalNumberOfShares = userShares.Sum(x => x.NoOfShares);
            user.TotalGrossAmountOfShares = userShares.Sum(x => x.Amount);

            return user;
        }