public static TypePoint ToBo(this TypePointModel model) { if (model == null) { return(null); } return(new TypePoint { Id = model.Id, Libelle = model.Libelle, }); }
public ActionResult Delete(int idPoint) { var result = MgtPoint.GetInstance().GetPointById(idPoint).ToModel(); RaceModel race = MgtRace.GetInstance().GetRace(result.IdCourse).ToModel(); TypePointModel typePoint = MgtTypePoint.GetInstance().GetTypePoint(result.IdTypePoint).ToModel(); result.LibelleCourse = race.Title; result.LibelleTypePoint = typePoint.Libelle; if (result == null) { return(HttpNotFound()); } return(View(result)); }
public ActionResult Create(TypePointModel typePoint) { try { if (ModelState.IsValid && MgtTypePoint.GetInstance().AddTypePoint(typePoint.ToBo())) { return(RedirectToAction("Index")); } else { return(View()); } } catch { return(View()); } }
public ActionResult Edit(TypePointModel typePoint) { try { var result = MgtTypePoint.GetInstance().UpdateTypePoint(typePoint.ToBo()); if (result) { return(RedirectToAction("Index")); } else { return(View()); } } catch { return(View()); } }