public Task <GetByIdResult <RobotBlueprint> > GetById(RobotBlueprintId robotBlueprintId)
        {
            RobotBlueprintModel result;

            try
            {
                result = internalRepository.Get(robotBlueprintId.Value);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(Task.FromResult <GetByIdResult <RobotBlueprint> >(new GetByIdResult <RobotBlueprint> .Error(e)));
            }

            if (result == null)
            {
                return(Task.FromResult <GetByIdResult <RobotBlueprint> >(new GetByIdResult <RobotBlueprint> .NotFound()));
            }

            var robotBlueprint = new RobotBlueprint(
                new RobotBlueprintId(result.Id),
                result.Version,
                result.HumanReadableName,
                result.Description,
                result.ProductionEfford);

            return(Task.FromResult <GetByIdResult <RobotBlueprint> >(new GetByIdResult <RobotBlueprint> .Success(robotBlueprint)));
        }
Пример #2
0
 public RobotBlueprint(RobotBlueprintId id, long version, string humanReadableName, string description, long productionEfford)
 {
     Id                = id;
     Version           = version;
     HumanReadableName = humanReadableName;
     Description       = description;
     ProductionEfford  = productionEfford;
 }