internal Job Edit(Job jobToUpdate, string userId) { Job foundJob = GetById(jobToUpdate.Id); // NOTE Check if not the owner, and price is increasing if (foundJob.UserId != userId && foundJob.Price < jobToUpdate.Price) { if (_repo.BidOnJob(jobToUpdate)) { foundJob.Price = jobToUpdate.Price; return(foundJob); } throw new Exception("Could not bid on that job"); } if (foundJob.UserId == userId && _repo.Edit(jobToUpdate, userId)) { return(jobToUpdate); } throw new Exception("You cant edit that, it is not yo job!"); }