public ActionResult LouerCopie(int id) { if (!GestionConnexion.estConnecte()) { return(RedirectToAction("Index", "Home")); } FilmDao filmDao = new FilmDao(); filmDao.LouerCopie(id, ((Client)System.Web.HttpContext.Current.Session["UtilisateurConnecté"]).Id); return(RedirectToAction("DetailsFilm", "Film", new { id })); }
public void Film_Location_Transaction() { FilmDao film_dao = new FilmDao(); ClientDao client_dao = new ClientDao(); Client result_client = client_dao.GetClientParCourrielEtMotDePasse("*****@*****.**", "hello123"); Film f1 = film_dao.GetFilmParId(1); int check1 = film_dao.GetNbCopiesRestantes(f1.Id); film_dao.LouerCopie(f1.Id, result_client.Id); int check2 = film_dao.GetNbCopiesRestantes(f1.Id); Assert.AreEqual(check1 - 1, check2); }