// GET: /<controller>/ public RentPointController(IQueryBuilder queryBuilder, ICommandBuilder commandBuilder) { _queryBuilder = queryBuilder; _commandBuilder = commandBuilder; if (!_queryBuilder.For <IEnumerable <RentPoint> >().With(new EmptyCriterion()).Any()) { AddEmployeeCommandContext employeeContext = new AddEmployeeCommandContext() { Surname = "Ivanov", FirstName = "Ivan", Patronymic = "Ivanovich" }; _commandBuilder.Execute(employeeContext); AddRentPointCommandContext komprosRentPointContext = new AddRentPointCommandContext() { Name = "Компрос", Employee = employeeContext.CreatedEmployee, Money = 10000 }; _commandBuilder.Execute(komprosRentPointContext); AddRentPointCommandContext leninaRentPointContext = new AddRentPointCommandContext() { Name = "Ленина", Employee = employeeContext.CreatedEmployee, Money = 10000 }; _commandBuilder.Execute(leninaRentPointContext); _commandBuilder.Execute(new AddBikeCommandContext() { Name = "Kama", Cost = 1000, HourCost = 100, RentPoint = komprosRentPointContext.CreatedRentPoint }); _commandBuilder.Execute(new AddBikeCommandContext() { Name = "Stels", Cost = 1000, HourCost = 100, RentPoint = komprosRentPointContext.CreatedRentPoint }); _commandBuilder.Execute(new AddBikeCommandContext() { Name = "Forward", Cost = 1000, HourCost = 100, RentPoint = komprosRentPointContext.CreatedRentPoint }); _commandBuilder.Execute(new AddBikeCommandContext() { Name = "Lexus134", Cost = 1000, HourCost = 100, RentPoint = leninaRentPointContext.CreatedRentPoint }); } }
public RentPoint AddRentPoint(Employee myEmployee) { var context = new AddRentPointCommandContext { Employee = myEmployee }; _commandBuilder.Execute(context); return context.CreatedRentPoint; }
public RentPoint AddRentPoint(string name, Employee myEmployee, decimal money = 10000) { AddRentPointCommandContext context = new AddRentPointCommandContext() { Name = name, Employee = myEmployee, Money = money }; _commandBuilder.Execute(context); return(context.CreatedRentPoint); }
public RentPoint AddRentPoint(string name, string adress, Employee myEmployee) { var context = new AddRentPointCommandContext { Name = name, Adress = adress, Employee = myEmployee }; _commandBuilder.Execute(context); return(context.CreatedRentPoint); }
public void GetRentPointsFromMyDb() { //Это мы как будто из базы получаем эти точки var context = new AddRentPointCommandContext { Name = "rp1", Adress = "adress1", Employee = new Employee("Nya", "Nyan", "Nyanyan") }; _commandBuilder.Execute(context); context = new AddRentPointCommandContext { Name = "rp2", Adress = "adress2", Employee = new Employee("Nya2", "Nyan2", "Nyanyan2") }; _commandBuilder.Execute(context); context = new AddRentPointCommandContext { Name = "rp3", Adress = "adress3", Employee = new Employee("Nya3", "Nyan3", "Nyanyan3") }; _commandBuilder.Execute(context); _commandBuilder.Execute(new AddBikeCommandContext { Name = "Raindow Crash", Cost = 10000, HourCost = 100 }); Bike currentBike = _queryBuilder .For <Bike>() .With(new BikeNameCriterion { Name = "Raindow Crash" }); _commandBuilder.Execute(new MoveBikeCommandContext { Bike = currentBike, RentPoint = context.CreatedRentPoint }); }