コード例 #1
0
        private AdminUpdateCustomerRoleViewModel AssignCustomerDetailsForUpdate(CustomerViewModel record)
        {
            if (record == null || String.IsNullOrWhiteSpace(record.Id))
                return null;

            var itemToUpdate = new AdminUpdateCustomerRoleViewModel()
            {
                UserId = record.Id,
                Email = record.Email,
                Status = record.Status,
                UserRoles = db.Roles.OrderBy(x => x.Name).ToList()
            };

            if (itemToUpdate == null || String.IsNullOrWhiteSpace(itemToUpdate.UserId))
                return null;

            return itemToUpdate;
        }
コード例 #2
0
        public ApplicationUser AdminUpdateCustomerStatus(AdminUpdateCustomerRoleViewModel item, string status)
        {
            var record = db.Users.Where(x => x.Id == item.UserId).FirstOrDefault();
            if (record == null || String.IsNullOrWhiteSpace(record.Id))
                return null;

            var itemToUpdate = AssignUserStatusForUpdate(record, status);
            if (itemToUpdate == null || String.IsNullOrWhiteSpace(itemToUpdate.Id))
                return null;

            return itemToUpdate;
        }