public ActionResult Create(DemandeViewModel demande) { try { if (demande.email.Length > 0 && demande.firstName.Length > 0 && demande.lastName.Length > 0 && demande.specialite.Length > 0 && demande.ville.Length > 0 && demande.email.Length > 0) { // TODO: Add insert logic here HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:18080"); // client.PostAsJsonAsync<DemandeViewModel>("Epione-web/rest/doctolib/ajoutDemande", demande)/*.ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode())*/; var result = client.PostAsJsonAsync <DemandeViewModel>("Epione-web/rest/doctolib/ajoutDemande", demande).Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("ConfirmDemande")); } else { ViewBag.result = "Demande existe deja"; } } else { ViewBag.result = "Tout les champs sont obligatoire ! "; } return(View()); } catch { return(View()); } }
// GET: api/Demandes public List <DemandeViewModel> GetDemandes() { //instance List de type PostesDansCategorie List <DemandeViewModel> ListDem = new List <DemandeViewModel>(); // instance objet de PostesDansCategorie //recuperer tout les valeur de categories var dem = db.Demandes.ToList(); //boucler sur cat pour recuperer les categorie foreach (var d in dem) { //instance d'objet DemandeViewModel dvm = new DemandeViewModel(); dvm.ID = d.ID; dvm.ClientID2 = d.ClientID2; dvm.ClientID = d.ClientID; dvm.Demande_title = d.Demande_title; dvm.Demande_description = d.Demande_description; dvm.Date_debut = d.Date_debut; dvm.Date_fin = d.Date_fin; ListDem.Add(dvm); } return(ListDem); }
public ActionResult Delete(string email, FormCollection collection) { try { DemandeViewModel dem = new DemandeViewModel(); dem.email = email; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:18080"); client.PostAsJsonAsync <DemandeViewModel>("Epione-web/rest/doctolib/RejectDemande", dem) /*.ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode())*/; return(RedirectToAction("Index")); } catch { return(View()); } }
public IHttpActionResult GetDemande(int id) { Demande demande = db.Demandes.Find(id); DemandeViewModel dvm = new DemandeViewModel(); if (demande == null) { return(NotFound()); } else { dvm.ID = demande.ID; dvm.ClientID2 = demande.ClientID2; dvm.ClientID = demande.ClientID; dvm.Demande_title = demande.Demande_title; dvm.Demande_description = demande.Demande_description; dvm.Date_debut = demande.Date_debut; dvm.Date_fin = demande.Date_fin; } return(Ok(dvm)); }
public DemandeUserControl() { InitializeComponent(); DataContext = new DemandeViewModel(); }
public ListeDemandesWindow(TypeImmobilier t) : this() { DataContext = new DemandeViewModel(t); }
public ListeDemandesWindow(Region r) : this() { DataContext = new DemandeViewModel(r); }
public ListeDemandesWindow(ObservableCollection <Demande> d) : this() { DataContext = new DemandeViewModel(d); }
public ListeDemandesWindow(Client c) : this() { DataContext = new DemandeViewModel(c); }