internal Castle Update(Castle update) { Castle original = GetById(update.Id); if (_repo.Update(original)) { return(original); } throw new Exception("Something Went Wrong???"); }
internal Castle Update(Castle update) { Castle original = GetById(update.Id); original.Id = update.Id > 0 ? update.Id : original.Id; original.Name = update.Name.Length > 0 ? update.Name : original.Name; if (_repo.Update(original)) { return(original); } throw new Exception("Something Went Wrong???"); }
internal Castle Update(Castle update) { Castle original = GetById(update.Id); original.Name = update.Name.Length > 0 ? update.Name : original.Name; original.YearBuilt = update.YearBuilt > 0 ? update.YearBuilt : original.YearBuilt; original.YearLastInvaded = update.YearLastInvaded > 0 ? update.YearLastInvaded : original.YearLastInvaded; original.Location = update.Location.Length > 0 ? update.Location : original.Location; original.ImgUrl = update.ImgUrl.Length > 0 ? update.ImgUrl : original.ImgUrl; if (_repo.Update(original)) { throw new Exception("Invalid Response"); } return(original); }