public static string AjouterReservationDansLaBase(RESERVATION_MODEL model) { RESERVATIONs reservation = IntReservationFromModel(model); using (unitOfWork unitOfWork = new unitOfWork()) { return(unitOfWork.ReservationRepository.Add(reservation)); } }
public static RESERVATIONs IntReservationFromModel(RESERVATION_MODEL model) { RESERVATIONs reservation = new RESERVATIONs(); reservation.PROMOTION = model.PROMOTION; reservation.MATIERE = model.MATIERE; reservation.SALLE = model.SALLE; reservation.PROFESSEUR = model.PROFFESSEUR; reservation.DATE_DEBUT = Convert.ToDateTime(model.DATE_DEBUT); reservation.DATE_FIN = Convert.ToDateTime(model.DATE_FIN); reservation.DATE = Convert.ToDateTime(model.DATE); return(reservation); }
public static List <RESERVATION_MODEL> mappingResultDbToModel(List <RESERVATIONs> dbResult) { List <RESERVATION_MODEL> modelList = new List <RESERVATION_MODEL>(); foreach (var item in dbResult) { RESERVATION_MODEL model = new RESERVATION_MODEL(); model.DATE = item.DATE; model.DATE_DEBUT = item.DATE_DEBUT; model.DATE_FIN = item.DATE_FIN; model.MATIERE = item.MATIERE; model.PROFFESSEUR = item.PROFESSEUR; model.PROMOTION = item.PROMOTION; model.SALLE = item.SALLE; modelList.Add(model); } return(modelList); }
public ActionResult enregistrer(string promotion, string matiere, string salle, string professeur, string heuredebut, string heurefin, string date) { string messErreur = null; RESERVATION_MODEL reservation = new RESERVATION_MODEL(); reservation.PROMOTION = promotion; reservation.MATIERE = matiere; reservation.SALLE = salle; reservation.PROFFESSEUR = professeur; reservation.DATE_DEBUT = Convert.ToDateTime(heuredebut); reservation.DATE_FIN = Convert.ToDateTime(heurefin); reservation.DATE = Convert.ToDateTime(date); messErreur = PlanningService.AjouterReservationDansLaBase(reservation); //if (messErreur == null) //{ //} return(Content(messErreur, null)); }