public ActionResult Edit(String name, HttpPostedFileBase file) { League league = null; if (ModelState.IsValid) { try { if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); String path = Path.Combine(Server.MapPath("~/images"), fileName); file.SaveAs(path); String pathInXML = "/images/" + file.FileName; league = new League(name, pathInXML); _repository.EditLeague(league); return(RedirectToAction("Index")); } } catch (Exception e) { ModelState.AddModelError("", "Error insert new league: " + e.Message); } } return(View(league)); }
public void EditLeague(League league) { _leaguerepo.EditLeague(league); }