示例#1
0
        public Result Handle(AddGirlScoutCommand command)
        {
            var repository = new TroopRepository(_unitOfWork);
            var troop      = repository.GetTroop(command.TroopId);

            if (troop == null)
            {
                return(Result.Fail($"No troop with Id: {command.TroopId}"));
            }

            var girlScout = new GirlScout
            {
                FirstName       = command.FirstName,
                LastName        = command.LastName,
                Inventory       = new GirlScoutCookieInventory(),
                ParentFirstName = command.ParentFirstName,
                ParentLastName  = command.ParentLastName,
                PhoneNumber     = command.PhoneNumber
            };

            troop.AddGirlScout(girlScout);

            _unitOfWork.Commit();

            return(Result.Ok());
        }
示例#2
0
    static void Main(String[] args)
    {
        GirlScout girl1 = new GirlScout("Jenny", 450, 3.25);

        Console.WriteLine(girl1);
        GirlScout girl2 = new GirlScout("Jaime", 465, 5.85);

        Console.WriteLine(girl2);
        Console.WriteLine("Our motto: {0}", GirlScout.scoutMotto);
    }