示例#1
0
        public IActionResult Take(string name, string surname, string firstName, string patronymic, decimal money)
        {
            AddClientCommandContext clientCommandContext = new AddClientCommandContext()
            {
                FirstName  = firstName,
                Surname    = surname,
                Patronymic = patronymic
            };

            _commandBuilder.Execute(clientCommandContext);
            MoneyDeposit deposit = new MoneyDeposit(money);
            Bike         bike    = _queryBuilder.For <Bike>().With(new NameCriterion()
            {
                Name = name
            });

            _commandBuilder.Execute(new GetBikeInRentCommandContext()
            {
                Bike    = bike,
                Client  = clientCommandContext.CreatedClient,
                Deposit = deposit
            });
            ViewData["Message"] = string.Format("{0} взял в прокат {1} и отдал в качестве депозита {2} рублей",
                                                clientCommandContext.CreatedClient.FullName, name, money.ToString());
            return(View());
        }
示例#2
0
        public Client CreateClient(string surname, string firstname, string patronymic)
        {
            AddClientCommandContext context = new AddClientCommandContext()
            {
                Surname    = surname,
                FirstName  = firstname,
                Patronymic = patronymic
            };

            _commandBuilder.Execute(context);
            return(context.CreatedClient);
        }