Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateExistingCustomer(CreateCustomerViewModel vm)
        {
            var CustomerToUpdate = ctx.Customers.Where(x => x.CustomerId == vm.CustomerId).FirstOrDefault();

            try
            {
                CustomerToUpdate.Name                 = vm.Name;
                CustomerToUpdate.CustomerId           = vm.CustomerId;
                CustomerToUpdate.InvoiceAddress       = vm.InvoiceAddress;
                CustomerToUpdate.SecondInvoiceAddress = vm.SecondInvoiceAddress;
                CustomerToUpdate.ZipCode              = vm.ZipCode;
                CustomerToUpdate.City                 = vm.City;
                CustomerToUpdate.Country              = vm.Country;
                CustomerToUpdate.OrganisationNumber   = vm.OrganisationNumber;
                CustomerToUpdate.PhoneNumber          = vm.PhoneNumber;
                CustomerToUpdate.SecondPhoneNumber    = vm.SecondPhoneNumber;
                CustomerToUpdate.Fax          = vm.Fax;
                CustomerToUpdate.EmailAddress = vm.EmailAddress;
                CustomerToUpdate.WebAddress   = vm.WebAddress;
                CustomerToUpdate.Description  = vm.Description;

                ctx.Customers.Update(CustomerToUpdate).State = EntityState.Modified;
                await ctx.SaveChangesAsync();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(Ok());
        }
        public CustomerRegistrationTests()
        {
            var mapper = AutomapperConfiguration.Init();

            _customerRepository = Substitute.For <ICustomerRepository>();
            _creditCardGateway  = Substitute.For <ICreditCardGateway>();
            _mailConfirmer      = Substitute.For <IMailConfirmer>();

            // Default objects ('stubs')
            var customer = Mocks.GetCustomer();

            _vm = Mocks.GetCreateCustomerViewModel();
            _creditCardGatewayResponse = Mocks.GetCreditCardGatewayResponse();

            // Default system under test ('sut')
            _sut = new CustomerRegistration(mapper, _customerRepository,
                                            _mailConfirmer, _creditCardGateway);

            // Default Behaviour
            _customerRepository.Create(Arg.Any <Customer>()).Returns(customer);
            _customerRepository.CreateRop(Arg.Any <Customer>()).Returns(Result.Ok(customer));
            _customerRepository.UpgradeToPremium(Arg.Any <Customer>()).Returns(Result.Ok(customer));
            _creditCardGateway.Charge(Arg.Any <string>()).Returns(_creditCardGatewayResponse);
            _creditCardGateway.ChargeRop(Arg.Any <string>()).Returns(Result.Ok(_creditCardGatewayResponse));
            _creditCardGateway.RollBackLastTransactionRop(Arg.Any <Customer>()).Returns(Result.Ok(customer));

            _mailConfirmer.SendWelcomeRop(Arg.Any <Customer>()).Returns(Result.Ok(customer));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Create(CreateCustomerViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                vm.Subscriptions = await _context.Subscriptions.ToListAsync();

                return(View(vm));
            }

            if (User.IsInRole("Admin"))
            {
                Customer nc = new Customer
                {
                    Firstname    = vm.Firstname,
                    Lastname     = vm.Lastname,
                    Email        = vm.Email,
                    Subscription = await _context.Subscriptions.SingleOrDefaultAsync(s => s.Id.Equals(vm.SubscriptionId))
                };

                _context.Customers.Add(nc);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(HttpNotFound());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create(CreateCustomerViewModel model)
        {
            if (ModelState.IsValid)
            {
                var customer = new Customer()
                {
                    Forename           = model.Forename,
                    MiddleNames        = model.MiddleNames,
                    Surname            = model.Surname,
                    Email              = model.Email,
                    UserName           = model.Email,
                    DateOfBirth        = model.DateOfBirth,
                    TimeOfRegistration = DateTime.Now,
                    EmailConfirmed     = true
                };

                await _userManager.CreateAsync(customer, model.Password);

                await _userManager.AddToRoleAsync(customer, "Customer");

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult Create(CreateCustomerViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("Error", "Error! Please try again!");
                return(View(model));
            }

            Customer customer = new Customer()
            {
                CustomerCode   = model.CustomerCode,
                CustomerName   = model.CustomerName,
                Phone          = model.Phone,
                Address        = model.Address,
                DateOfBirth    = model.DateOfBirth,
                Referral       = model.Referral,
                CustomerTypeId = model.CustomerTypeId,
                DistrictId     = model.DistrictId
            };

            try
            {
                _db.Customer.Add(customer);
                _db.SaveChanges();
            }
            catch
            {
                ModelState.AddModelError("Error", "Error! Please try again!");
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public IActionResult CreateCustomer(CreateCustomerViewModel model)
        {
            if (ModelState.IsValid)
            {
                Accounts account = new Accounts
                {
                    Created   = DateTime.Now,
                    Frequency = "Monthly",
                    Balance   = 0m,
                };

                Dispositions disposition = new Dispositions
                {
                    Type     = "Owner",
                    Customer = model.Customer,
                    Account  = account
                };

                model.Accounts     = account;
                model.Dispositions = disposition;
                _context.AddRange(model.Customer, model.Dispositions, model.Accounts);
                _context.SaveChanges();

                return(RedirectToAction("Index", "Home"));
            }

            return(View(model));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Takes the info from a create customer view model and creates a new customer if that user name is not in use.
        /// </summary>
        /// <param name="createdPlayer">Create customer view model being created</param>
        /// <returns>Returns and logs in a new Customer info view model</returns>
        public CustomerInfoViewModel CreateUser(CreateCustomerViewModel createdPlayer)
        {
            StoreLocation favoriteStore = _repo.GetStoreByName(createdPlayer.StoreNameChosen);

            Customer customer = new Customer()
            {
                CustomerUserName = createdPlayer.CustomerUserName,
                CustomerPassword = createdPlayer.CustomerPassword,
                CustomerFName    = createdPlayer.CustomerFName,
                CustomerLName    = createdPlayer.CustomerLName,
                CustomerAge      = createdPlayer.CustomerAge,
                CustomerBirthday = createdPlayer.CustomerBirthday,
                PerferedStore    = favoriteStore
            };

            // if null????
            Customer newCustomer = _repo.CreateUser(customer);

            if (newCustomer == null)
            {
                return(null);
            }

            CustomerInfoViewModel newCustomerViewModel = _mapper.ConvertCustomerToCustomerInfoViewModel(newCustomer);

            return(newCustomerViewModel);
        }
        //[Bind("Id,UserId,KayakId,Name,PhoneNumber,Email,RentalDate,ReturnDate")]
        //Customer customer

        public async Task <IActionResult> Create(CreateCustomerViewModel vm)
        {
            if (ModelState.IsValid && vm.Customer.KayakId != 0)
            {
                var currentUser = await GetCurrentUserAsync();

                vm.Customer.UserId = currentUser.Id;
                _context.Add(vm.Customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            vm.Kayaks = _context.Kayaks.Select(c => new SelectListItem
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();

            vm.Kayaks.Insert(0, new SelectListItem()
            {
                Value = "0",
                Text  = "Please Choose A Kayak"
            });

            return(View(vm));
        }
Ejemplo n.º 9
0
        public ActionResult SaveCustomer(CreateCustomerViewModel customer)
        {
            try
            {
                Customer newCustomer = new Customer
                {
                    Name = customer.Name,
                    RegisteredAddress = new Address {
                        Address1 = customer.Address1, PostalCode = customer.PostalCode
                    },
                    Contacts = new List <Contact>()
                    {
                        new Contact {
                            Name = customer.MainContact
                        }
                    }
                };

                _customerRepository.InsertNewCustomer(newCustomer, "nobody");

                messageSender.SendMessage(new NewCustomerCreatedEvent
                {
                    NewCustomer   = newCustomer,
                    CorrelationId = Guid.NewGuid()
                });

                return(Ok(newCustomer));
            }
            catch (Exception ex)
            {
                return(Redirect("Error.html"));
            }
        }
Ejemplo n.º 10
0
        public IActionResult Create(CreateCustomerViewModel customerViewModel)
        {
            Customer customer = new Customer();

            if (ModelState.IsValid)
            {
                customer.Name      = customerViewModel.Name;
                customer.Address   = customerViewModel.Address;
                customer.Telephone = customerViewModel.Telephone;
                customer.Email     = customerViewModel.Email;
                customer.HomePage  = customerViewModel.HomePage;
                customer.IndustrialClassification = customerViewModel.IndustrialClassification;
                customer.Subsidiaries             = customerViewModel.Subsidiaries;
                customer.CVR                  = customerViewModel.CVR;
                customer.Responsible          = customerViewModel.Responsible;
                customer.ResponsibleEmail     = customerViewModel.ResponsibleEmail;
                customer.ResponsibleTelephone = customerViewModel.ResponsibleTelephone;
                customer.IsPBSPayment         = customerViewModel.IsPBSPayment;
                if (customerViewModel.IsPBSPayment)
                {
                    customer.RegistrationNumber = customerViewModel.RegistrationNumber;
                    customer.AccountNumber      = customerViewModel.AccountNumber;
                }

                customer.MultiannualAgreement = customerViewModel.MultiannualAgreement;
                customer.Forwards             = customerViewModel.Forwards;
                customer.Activities           = customerViewModel.Activities;

                customerService.Save(customer);
                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
Ejemplo n.º 11
0
        private ApiResponse <int> Create(CreateCustomerViewModel model)
        {
            var apiResp = new ApiResponse <int>
            {
                Type = ResponseType.Fail
            };

            var customer = new Dto.Customer
            {
                AuthorizedPersonName = model.AuthorizedPersonName,
                PhoneNumber          = model.PhoneNumber,
                Title     = model.Title,
                UserId    = GetUserId().Value,
                CreatedAt = DateTime.UtcNow
            };

            var resp = _customerBusiness.Add(customer);

            if (resp.Type != ResponseType.Success)
            {
                apiResp.ErrorCode = resp.ErrorCode;
                return(apiResp);
            }

            apiResp.Type = ResponseType.Success;
            apiResp.Data = customer.Id;

            return(apiResp);
        }
Ejemplo n.º 12
0
        public void SetUp()
        {
            _fakeNavigationService = Substitute.For <INavigationService>();
            _fakePageDialogService = Substitute.For <IPageDialogService>();
            _fakeApiService        = Substitute.For <IBackendApiService>();
            _fakeSessionService    = Substitute.For <ISessionService>();

            _uut = new CreateCustomerViewModel(_fakeNavigationService, _fakePageDialogService, _fakeApiService, _fakeSessionService);

            _fakeHttpCreateCustomerSuccessResponse = new CreateCustomerResponse(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("{\n  \"token\": \"valid token\",\n  \"customer\": {\n    \"name\": \"customer name\",\n    \"email\": \"[email protected]\",\n    \"phoneNumber\": \"12345678\"\n  }\n}", Encoding.UTF8, "application/json")
            });

            _fakeHttpCreateCustomerBadRequestResponse = new CreateCustomerResponse(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.BadRequest,
                Content    = new StringContent("{\n\t\"token\": null,\n\t\"customer\": null,\n\t\"errors\": {\n\t\t\"error\": [\"Username already taken\"]\n\t}\n}", Encoding.UTF8, "application/json")
            });

            _uut.Request.Email    = "*****@*****.**";
            _uut.Request.Name     = "test tester";
            _uut.Request.Password = "******";
            _uut.Request.Password = "******";
            _uut.Request.Phone    = "12345678";
        }
        private ApplicationUser createApplicationUser(CreateCustomerViewModel customerViewModel)
        {
            var appUser = new ApplicationUser
            {
                UserName        = customerViewModel.EmailAddress,
                Email           = customerViewModel.EmailAddress,
                IsActive        = true,
                PhoneNumber     = customerViewModel.PhoneNumber,
                CustomerDetails = new Customer
                {
                    CreatedBy       = customerViewModel.CreatedBy,
                    DateCreated     = DateTime.Now,
                    EmailAddress    = customerViewModel.EmailAddress,
                    CustomerId      = IdentityGenerator.NewSequentialGuid(),
                    CustomerNumber  = IdentityGenerator.GenerateCustomerNumber(),
                    FirstName       = customerViewModel.FirstName,
                    PhoneNumber     = customerViewModel.PhoneNumber,
                    Identification  = customerViewModel.Identification,
                    MiddleName      = customerViewModel.MiddleName,
                    Surname         = customerViewModel.Surname,
                    UserGender      = customerViewModel.UserGender,
                    CustomerAccount = new Account
                    {
                        AccountNumber = IdentityGenerator.GenerateAccountNumber(),
                        CreatedBy     = customerViewModel.CreatedBy,
                        DateCreated   = DateTime.Now,
                        AccountId     = IdentityGenerator.NewSequentialGuid(),
                    }
                }
            };

            return(appUser);
        }
Ejemplo n.º 14
0
        public void Add_Customer_ReturnsCreatedResponse()
        {
            // Arrange
            var createCustomerViewModel = new CreateCustomerViewModel
            {
                FirstName      = "Cliente A",
                LastName       = "Last name",
                Address        = "Avenue A",
                PersonalNumber = "0508851234"
            };

            var customerGuid      = Guid.NewGuid();
            var customerViewModel = new CustomerViewModel
            {
                Id             = customerGuid,
                FirstName      = createCustomerViewModel.FirstName,
                LastName       = createCustomerViewModel.LastName,
                Address        = createCustomerViewModel.Address,
                PersonalNumber = createCustomerViewModel.PersonalNumber
            };

            _mockCustomerAppService.Setup(c => c.Add(createCustomerViewModel)).Returns(customerViewModel);

            // Act
            var result = _customerController.Post(createCustomerViewModel);

            // Assert
            Assert.IsType <CreatedAtActionResult>(result);
            var createdResult = result as CreatedAtActionResult;

            Assert.Equal(customerGuid, createdResult.RouteValues["id"]);
        }
Ejemplo n.º 15
0
        // ~30 LOC (using 'compact' formatting)
        // Only by introducing simple try/catch blocks...
        private CustomerCreatedViewModel RegisterCustomer3(
            CreateCustomerViewModel createCustomerViewModel)
        {
            Customer customer;

            try { customer = Validate(createCustomerViewModel); }
            catch (Exception e) { return(CreateErrorResponse(e)); }

            try { customer = _customerRepository.Create(customer); }
            catch (Exception e) { return(CreateErrorResponse(e)); }

            if (createCustomerViewModel.WantsPremiumSupport)
            {
                var creditCardGatewayResponse = _creditCardGateway
                                                .Charge(customer.CreditCardNumber);

                if (creditCardGatewayResponse.ChargeWasBooked)
                {
                    try { _customerRepository.Upgrade(customer); }
                    catch (Exception e) { return(CreateErrorResponse(e)); }
                }
            }

            try { _mailConfirmer.SendWelcome(customer); }
            catch (Exception e) { return(CreateErrorResponse(e)); }

            return(new CustomerCreatedViewModel(customer.Id));
        }
Ejemplo n.º 16
0
        // only hinting try/catch...
        private CustomerCreatedViewModel RegisterCustomer2(
            CreateCustomerViewModel createCustomerViewModel)
        {
            // can throw
            var customer = Validate(createCustomerViewModel);

            // can throw
            customer = _customerRepository.Create(customer);

            if (createCustomerViewModel.WantsPremiumSupport)
            {
                var creditCardGatewayResponse = _creditCardGateway
                                                .Charge(customer.CreditCardNumber);

                if (creditCardGatewayResponse.ChargeWasBooked)
                {
                    // can throw
                    _customerRepository.Upgrade(customer);
                }
            }

            // can throw
            _mailConfirmer.SendWelcome(customer);

            return(new CustomerCreatedViewModel(customer.Id));
        }
Ejemplo n.º 17
0
        // LOC: ~10
        private CustomerCreatedViewModel RegisterCustomerSimple1(
            CreateCustomerViewModel createCustomerViewModel)
        {
            Customer customer;

            try
            {
                customer = Validate(createCustomerViewModel);
            }
            catch (Exception e) { return(CreateErrorResponse(e)); }

            try
            {
                customer = _customerRepository.Create(customer);
            }
            catch (Exception e) { return(CreateErrorResponse(e)); }

            try
            {
                _mailConfirmer.SendWelcome(customer);
            }
            catch (Exception e)
            {
                // handle mailing exception (ie logging, retry-policy, etc)
            }

            return(new CustomerCreatedViewModel(customer.Id));
        }
        public async Task <CreateCustomerResponse> CreateCustomer(CreateCustomerViewModel customer)
        {
            var client = _requestClientCreator.Create <ICreateCustomerRequest, CreateCustomerResponse>();
            var createCustomerRequest = new CreateCustomerRequest(Guid.NewGuid(), customer.Name, customer.Address);
            var response = await client.Request(createCustomerRequest);

            return(response);
        }
Ejemplo n.º 19
0
        public async Task <IActionResult> Create([FromBody] CreateCustomerViewModel model)
        {
            string strRuta = _config["CustomerAvatar"];

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Customer modelo = new Customer
            {
                CompanyId      = model.CompanyId,
                Enabled        = true,
                Address        = model.Address,
                CountryId      = model.CountryId,
                StateId        = model.StateId,
                CityId         = model.CityId,
                Names          = model.Names,
                Phone          = model.Phone,
                DateInitial    = DateTime.Now,
                Documento      = model.Documento,
                DocumentTypeId = model.DocumentTypeId,
                Email          = model.Email,
                Favorite       = model.Favorite,
                Observation    = model.Observation,
                PriceListId    = model.PriceListId
            };


            _context.Customers.Add(modelo);
            try
            {
                await _context.SaveChangesAsync();


                //Guardo el avatar
                if (modelo.Id > 0)
                {
                    if (!(string.IsNullOrEmpty(model.LogoName)) && (!string.IsNullOrEmpty(model.Logo)))
                    {
                        strRuta = strRuta + "//" + modelo.Id.ToString() + "//" + model.LogoName;
                        System.IO.FileInfo file = new System.IO.FileInfo(strRuta);
                        file.Directory.Create();
                        System.IO.File.WriteAllBytes(strRuta, Convert.FromBase64String(model.Logo.Substring(model.Logo.LastIndexOf(',') + 1)));
                        modelo.Logo = strRuta;
                    }
                }

                _context.Entry(modelo).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }

            return(Ok());
        }
Ejemplo n.º 20
0
        private void OpenCustomerWizard()
        {
            //pass dependencies to CreateCustomerViewModel workspace and add it to the workspaces collection,
            //which will result in new tab appearing in UI:
            var customerWizard = new CreateCustomerViewModel(_customerRepository, _messageBoxService, LocalizationService);

            Workspaces.Add(customerWizard);
            SelectedWorkspace = customerWizard;
        }
Ejemplo n.º 21
0
        public ViewResult Create(CreateCustomerViewModel createCustomerViewModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(createCustomerViewModel));
            }

            return(this.View(new CreateCustomerViewModel()));
        }
Ejemplo n.º 22
0
        public int CreateCustomer(CreateCustomerViewModel customerViewModel)
        {
            var customer = Utilities.CopyEntityFields <CreateCustomerViewModel, Customer>(customerViewModel);

            _context.Customers.Add(customer);
            _context.SaveChanges();

            return(customer.Id);
        }
Ejemplo n.º 23
0
        public ActionResult CreateCustomer(int?id)
        {
            CreateCustomerViewModel ccvm = new CreateCustomerViewModel();

            ccvm.Seat = db.Seats.Find(id);
            //ViewBag.SeatInfo = "Seat " + vm.Seat.SeatName + " on Flight " + vm.Seat.Flight.FlightNumber.Number.ToString() + " on " + vm.Seat.Flight.DepartDateTime.Date.ToString();
            //vm.Customers = vm.Customers.OrderBy(d => d.AdvantageNumber).ThenBy(d => d.LastName).ThenBy(d => d.FirstName).ToList();
            return(View(ccvm));
        }
Ejemplo n.º 24
0
        public async Task <IActionResult> CreateCustomer(CreateCustomerViewModel customerViewModel, CancellationToken cancellationToken)
        {
            EnsureValidModelState();

            var request  = Mapper.Map <CreateCustomer>(customerViewModel);
            var response = await Mediator.Send(request, cancellationToken);

            return(await HandleAsync(response, cancellationToken));
        }
Ejemplo n.º 25
0
 public CreateCustomer(Button button, HardwareStoreContext dbContext)
 {
     _button           = button;
     _button.IsEnabled = false;
     _dbContext        = dbContext;
     InitializeComponent();
     this._viewModel  = new CreateCustomerViewModel();
     this.DataContext = _viewModel;
 }
        // GET: Customers/Create
        public IActionResult Create()
        {
            CreateCustomerViewModel createCustomerViewModel = new CreateCustomerViewModel();

            ViewData["States"]         = new SelectList(_context.States, "Id", "Name", "Select State");
            ViewData["Purposes"]       = new SelectList(_context.Purposes, "Id", "Name", "Select");
            ViewData["PropertyTypes"]  = new SelectList(_context.PropertyTypes, "Id", "Name");
            ViewData["OccupancyTypes"] = new SelectList(_context.OccupancyTypes, "Id", "Name");
            return(View(createCustomerViewModel));
        }
        public ActionResult Create()
        {
            var membershipTypes = _context.MembershipTypes.ToList();
            var model           = new CreateCustomerViewModel
            {
                MembershipTypes = membershipTypes
            };

            return(View(model));
        }
        public async Task <ActionResult> Create(CreateCustomerViewModel viewModel, CancellationToken cancellationToken)
        {
            var contract = mapper.Map <CreateCustomerRequest>(viewModel);

            var request = await client.PostAsJsonAsync("customers", contract, cancellationToken);

            request.EnsureSuccessStatusCode();

            return(RedirectToAction("Summary"));
        }
        public async Task <ActionResult> Edit(CreateCustomerViewModel viewModel, CancellationToken cancellationToken)
        {
            var request = mapper.Map <EditCustomerRequest>(viewModel);

            var response = await client.PutAsJsonAsync("customers", request, cancellationToken);

            response.EnsureSuccessStatusCode();

            return(RedirectToAction("Summary"));
        }
Ejemplo n.º 30
0
        public ActionResult Post([FromBody] CreateCustomerViewModel createCustomerViewModel)
        {
            if (createCustomerViewModel == null)
            {
                return(BadRequest());
            }

            _customerAppService.Add(createCustomerViewModel);

            return(Accepted());
        }
Ejemplo n.º 31
0
        public void CreateCustomer()
        {
            var controller = _container.Resolve<CustomerController>();
            var model = new CreateCustomerViewModel()
            {
                FirstName = "Ivan",
                LastName = "Dimitrov"
            };

            var result = controller.Create(model) as RedirectToRouteResult;
        }
Ejemplo n.º 32
0
        public ActionResult Create(CreateCustomerViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            try
            {
                _appService.Create(model);
            }
            catch(ApplicationException ex)
            {
                model.AddMessage(ex.Message);
                return View(model);
            }

            return RedirectToAction("Index");
        }
Ejemplo n.º 33
0
 public void Create(CreateCustomerViewModel model)
 {
     using (ITransaction transaction = _session.BeginTransaction())
     {
         try
         {
             var customer = new Customer(model.FirstName, model.LastName);
             _customerRepository.Add(customer);
         }
         catch (InvalidCustomerFirstNameException)
         {
             throw new ApplicationException("Invalid first name");
         }
         catch(InvalidCustomerLastNameException)
         {
             throw new ApplicationException("Invalid last name");
         }
         transaction.Commit();
     }
 }