public ActionResult AddOrUpdate(AcademyModel model) { if (!ModelState.IsValid) { return(View(model)); } var isCreated = model.Id == Guid.Empty; var academy = new Academies(); if (!isCreated) { academy = AcademyRepository.GetById(model.Id); } academy.Name = model.Name; if (isCreated) { AcademyRepository.Add(academy); } AcademyRepository.Save(); return(Redirect(Url.Action("Get", "Academy", new { id = academy.Id }))); }
public ActionResult DeleteConfirmed(int id) { Academies academies = db.Academies.Find(id); db.Academies.Remove(academies); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(Guid id) { Academies academies = academiesRepository.GetById(id); academiesRepository.Remove(academies); academiesRepository.Save(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Academies academies) { if (ModelState.IsValid) { db.Entry(academies).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(academies)); }
public ActionResult Edit([Bind(Include = "Id,Name")] Academies academies) { if (ModelState.IsValid) { academiesRepository.SetEntryState(academies, EntityState.Modified); academiesRepository.Save(); return(RedirectToAction("Index")); } return(View(academies)); }
public static AcademyModel ToModel(Academies academies) { return(new AcademyModel { Id = academies.Id, Name = academies.Name, Establishments = academies.Establishments.Select(e => new ModelWithNameAndId { Id = e.Id, Name = e.Name }) }); }
public ActionResult Create([Bind(Include = "Id,Name")] Academies academies) { if (ModelState.IsValid) { db.Academies.Add(academies); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(academies)); }
public ActionResult ResultatsRecherche(Academies rechercheViewModel) { if (!string.IsNullOrWhiteSpace(rechercheViewModel.Recherche)) { rechercheViewModel.ListAcademieRechercher = _academyRepository.GetAcademy().Where(r => r.Name.IndexOf(rechercheViewModel.Recherche, StringComparison.CurrentCultureIgnoreCase) >= 0).ToList(); } else { rechercheViewModel.ListAcademieRechercher = new List <Academies>(); } return(PartialView(rechercheViewModel)); }
public ActionResult Create([Bind(Include = "Id,Name")] Academies academies) { if (ModelState.IsValid) { academies.Id = Guid.NewGuid(); _academyRepository.InsertAcademy(academies); _academyRepository.Save(); return(RedirectToAction("Index")); } return(View(academies)); }
// GET: Academies/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academies academies = db.Academies.Find(id); if (academies == null) { return(HttpNotFound()); } return(View(academies)); }
public ActionResult EditAcademie(AcademieModels model) { using (AcademieRepository repository = new AcademieRepository()) { Academies a = repository.GetAcademieById(model.id); a.Name = model.name; if (ModelState.IsValid) { repository.Save(); } return(RedirectToAction("ReadAcademies")); } }
public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academies academies = academiesRepository.GetById(id); if (academies == null) { return(HttpNotFound()); } return(View(academies)); }
// GET: Academies/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academies academies = _academyRepository.GetAcademyByID(id); if (academies == null) { return(HttpNotFound()); } return(View(academies)); }
// GET: Academies/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academies academies = _academyRepository.GetAcademyByID(id); if (academies == null) { return(HttpNotFound()); } return(View(academies)); //Book student = _bookRepository.GetBookByID(id); //return View(student); }
public ActionResult CreateAcademie(AcademieModels model) { if (ModelState.IsValid) { using (AcademieRepository repository = new AcademieRepository()) { Academies a = new Academies { Id = Guid.NewGuid(), Name = model.name }; repository.Add(a); repository.Save(); } return(RedirectToAction("ReadAcademies")); } return(View(model)); }
// // GET: /GestionDesClasses/Edit/5 public ActionResult EditAcademie(Guid id) { AcademieModels model; using (AcademieRepository repository = new AcademieRepository()) { Academies a = repository.GetAcademieById(id); if (a == null) { return(HttpNotFound()); } model = new AcademieModels { mode = 0, id = a.Id, name = a.Name }; } return(View("CreateAcademie", model)); }
// GET: /GestionDesClasses/ReadAcademie/1122 public ActionResult ReadAcademie(Guid id) { AcademieModels model; using (AcademieRepository repository = new AcademieRepository()) { Academies a = repository.GetAcademieById(id); IQueryable <Establishments> l = repository.GetEstablishmentById(id); if (a == null) { return(HttpNotFound()); } model = new AcademieModels { id = a.Id, name = a.Name, etablissements = getListEtablissements(l) }; } return(View(model)); }
public void UpdateAcademy(Academies Academy) { _context.Entry(Academy).State = System.Data.Entity.EntityState.Modified; }
public void SetEntryState(Academies academies, EntityState entityState) { db.Entry(academies).State = entityState; }
public void Remove(Academies academies) { db.Academies.Remove(academies); }
public void Add(Academies academies) { db.Academies.Add(academies); }
public void Delete(Academies s) { data.Academies.Remove(s); }
public ActionResult Recherche(Academies rechercheViewModel) { return(View(rechercheViewModel)); }
public void InsertAcademy(Academies Academy) { _context.Academies.Add(Academy); }
public void DeleteAcademy(Guid?AcademyId) { Academies Academy = _context.Academies.Find(AcademyId); _context.Academies.Remove(Academy); }
public void Add(Academies s) { data.Academies.Add(s); }