internal House Edit(House houseToUpdate, string userId) { House foundHouse = GetById(houseToUpdate.Id); if (foundHouse.UserId != userId && foundHouse.Price < houseToUpdate.Price) { if (_repo.BidOnHouse(houseToUpdate)) { foundHouse.Price = houseToUpdate.Price; return(foundHouse); } throw new Exception("Could not Bid on that House"); } if (foundHouse.UserId == userId && _repo.Edit(houseToUpdate, userId)) { return(houseToUpdate); } throw new Exception("You Can't Edit That!"); }
internal House edit(House houseToUpdate, string userId) { House foundHouse = GetByHouseId(houseToUpdate.Id); if (foundHouse.UserId != userId && foundHouse.Price < houseToUpdate.Price) { if (_repo.BidOnHouse(houseToUpdate)) { foundHouse.Price = houseToUpdate.Price; return(foundHouse); } throw new Exception("Can't bid on that house"); } if (foundHouse.UserId == userId && _repo.edit(houseToUpdate, userId)) { return(houseToUpdate); } throw new Exception("that is not your house"); }
internal House Edit(House carToUpdate, string userId) { House foundHouse = GetById(carToUpdate.Id); // NOTE Check if not the owner, and price is increasing if (foundHouse.UserId != userId && foundHouse.Price < carToUpdate.Price) { if (_repo.BidOnHouse(carToUpdate)) { foundHouse.Price = carToUpdate.Price; return(foundHouse); } throw new Exception("Could not bid on that car"); } if (foundHouse.UserId == userId && _repo.Edit(carToUpdate, userId)) { return(carToUpdate); } throw new Exception("You cant edit that, it is not yo car!"); }