Problem description: As an example Ebay link
Can be shortened to https://www.ebay.com/itm//263591535536, so that it takes less space on the database .
I try to capture the full url
in Razer
page and then in the Controller I try to shorten it .
Then I get the validation error .
My code is:
if (ModelState.IsValid)
{
db.Entry(home).State = EntityState.Modified;
home.DetailUrl = RealHouses2.Models.Miscellaneous.RemoveExtraCharFromUrl(home.DetailUrl);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(home);
Error message is:
System.Data.Entity.Validation.DbEntityValidationException HResult=0x80131920 Message=Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
Thanks, Nick.McDermaid. Yes the issue is my method to reduce the URL length does not produce the correct url. So it produce a validation error. That corrected my mistake.
User contributions licensed under CC BY-SA 3.0