Hi,
If we can look at into below code
[HttpPost]
public ActionResult SaveOrder()
{
string fileName;
string result = "Error! Order Is Not Complete!";
{
using (var dbContextTransaction = db.Database.BeginTransaction())
{
try
{
// Get uploaded files from Request object.
if (Request.Files.Count > 0)
{
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFileBase postedFile = Request.Files[i];
.......
}
}
result = "Success! Order Is Complete!";
}
catch (Exception ex)
{
dbContextTransaction.Rollback();
return Json(result, JsonRequestBehavior.AllowGet);
}
}
}
return Json(result, JsonRequestBehavior.AllowGet);
}
it was returning like below if there is any error Error! Order Is Not Complete!
Instead of that i need to throw an exception what exception i raised
catch (Exception ex)
{
dbContextTransaction.Rollback();
return Json(result, JsonRequestBehavior.AllowGet);
}