So I have an Ajax form with validation, which works. My problem is my POST Action:
[HttpPost]
public ActionResult AddUpdateConfigs(StorageConfigurationModel modelbind)
{
if (ModelState.IsValid)
{
//blablabla more code
}
else
{
return PartialView("cbpnlNewUpdateConfigs",modelbind);
}
}
One of the things I do when the model is valid, is trying to use the values, for example, a UNC path I have, and I need to see if that UNC path exists, so I do:
try
{
DirectoryInfo dir = new DirectoryInfo(modelbind.Location);
if (dir.Exists)
{
//bla bla bla
}
else
{
return //something I dont know what
}
}
catch (Exception j)
{
return //something I dont know what
}
So I dont know what would be correct to return to match the Action
type and also have the proper message in the client side.
Any ideas?