public string Sell(string robotName, string ownerName) { IRobot currRobot = IsExist(robotName); garage.Sell(robotName, ownerName); string result = currRobot.IsChipped == true ? $"{ownerName} bought robot with chip" : $"{ownerName} bought robot without chip"; return(result); }
public string Sell(string robotName, string ownerName) { IRobot robot = GetRobot(robotName); _garage.Sell(robotName, ownerName); if (robot.IsChipped) { return(string.Format(OutputMessages.SellChippedRobot, ownerName)); } return(string.Format(OutputMessages.SellNotChippedRobot, ownerName)); }
public string Sell(string robotName, string ownerName) { garage.Sell(robotName, ownerName); var currentRobot = garage.Robots[robotName]; if (currentRobot.IsChipped) { return($"{ownerName} bought robot with chip"); } else { return($"{ownerName} bought robot without chip"); } }
public string Sell(string robotName, string ownerName) { RobotExist(robotName); IRobot robot = GetRobotByName(robotName); garage.Sell(robotName, ownerName); if (robot.IsChipped) { return($"{ownerName} bought robot with chip"); } return($"{ownerName} bought robot without chip"); }
public string Sell(string robotName, string ownerName) { CheckIfRobotExist(robotName); IRobot robot = Garage.Robots.Values.FirstOrDefault(x => x.Name == robotName); Garage.Sell(robotName, ownerName); if (robot.IsChipped) { return($"{ownerName} bought robot with chip"); } return($"{ownerName} bought robot without chip"); }
public string Sell(string robotName, string ownerName) { var currentRobot = this.garage.Robots.FirstOrDefault(x => x.Key == robotName).Value; garage.Sell(robotName, ownerName); if (currentRobot.IsChipped) { return($"{ownerName} bought robot with chip"); } return($"{ownerName} bought robot without chip"); }
public string Sell(string robotName, string ownerName) { IRobot robot = GetRobotByName(robotName); garage.Sell(robotName, ownerName); string result = string.Empty; if (robot.IsChipped) { result = string.Format(OutputMessages.SellChippedRobot, ownerName); } else { result = string.Format(OutputMessages.SellNotChippedRobot, ownerName); } return(result); }
public string Sell(string robotName, string ownerName) { if (!garage.Robots.ContainsKey(robotName)) { throw new ArgumentException(String.Format(ExceptionMessages.InexistingRobot, robotName)); } IRobot currRobot = garage.Robots[robotName]; garage.Sell(robotName, ownerName); if (currRobot.IsChipped) { return(String.Format(OutputMessages.SellChippedRobot, ownerName)); } else { return(String.Format(OutputMessages.SellNotChippedRobot, ownerName)); } }
public string Sell(string robotName, string ownerName)//check if robot exists { if (!this.garage.Robots.ContainsKey(robotName)) { throw new ArgumentException(string.Format(ExceptionMessages.InexistingRobot, robotName)); } IRobot currentRobot = this.garage.Robots.FirstOrDefault(r => r.Key == robotName).Value; garage.Sell(robotName, ownerName); if (currentRobot.IsChipped) { return(string.Format(OutputMessages.SellChippedRobot, ownerName)); } else { return(string.Format(OutputMessages.SellNotChippedRobot, ownerName)); } }
public string Sell(string robotName, string ownerName) { if (this.CheckRobotExist(robotName)) { return($"Robot {robotName} does not exist"); } var robot = this.garage.Robots[robotName]; garage.Sell(robotName, ownerName); if (robot.IsChipped) { return($"{ownerName} bought robot with chip"); } else { return($"{ownerName} bought robot without chip"); } }