internal Lego Edit(int id, Lego updatedLego) { Lego foundLego = GetById(id); //NOTE GetById() is already handling our null checking foundLego.Title = updatedLego.Title; return(_repo.Edit(foundLego)); }
internal Lego Edit(Lego update) { var exists = _repo.GetById(update.Id); if (exists == null) { throw new Exception("Invalid Id"); } // update.AuthorId = exists.AuthorId _repo.Edit(update); return(update); }