Błąd pobierania: Nie wszystkie ścieżki kodu zwracają wartość
Jestem nowy w mvc C # i utknąłem. Proszę doradzić, jak to naprawić. Dostaję błąd na Add. Kiedy najeżdżam na czerwoną, krętą linię, pojawia się komunikat „Nie wszystkie ścieżki kodu zwracają wartość”
public ActionResult Add(ShapeInputModel dto, FormCollection collection)
{
var model = new GeoRegions();
if (TryUpdateModel(model))
{
var destinationFolder = Server.MapPath("/App_Data/KML");
var postedFile = dto.Shape;
if (postedFile != null)
{
var fileName = Path.GetFileName(postedFile.FileName);
var path = Path.Combine(destinationFolder, fileName);
postedFile.SaveAs(path);
//Save to Database
Db.AddGeoRegions(model);
return RedirectToAction("Index");
}
return View();
}
}