public RequestTravelModel(REQUEST_TRAVEL objBdd) { Id = objBdd.ID_REQUEST_TRAVEL; IdTravel = objBdd.ID_TRAVEL; IdUser = objBdd.ID_USER; IdAction = objBdd.ID_ACTION; }
public ActionResult DeleteConfirmed(int id) { REQUEST_TRAVEL rEQUEST_TRAVEL = db.REQUEST_TRAVEL.Find(id); db.REQUEST_TRAVEL.Remove(rEQUEST_TRAVEL); db.SaveChanges(); return(RedirectToAction("Index")); }
public RequestTravelWithUserModel(REQUEST_TRAVEL objBdd) { Id = objBdd.ID_REQUEST_TRAVEL; IdTravel = objBdd.ID_TRAVEL; var userBdd = objBdd.USER; User = new UserLiteModel(userBdd); IdAction = objBdd.ID_ACTION; }
public ActionResult Edit([Bind(Include = "ID_REQUEST_TRAVEL,ID_TRAVEL,ID_USER,ID_ACTION")] REQUEST_TRAVEL rEQUEST_TRAVEL) { if (ModelState.IsValid) { db.Entry(rEQUEST_TRAVEL).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_ACTION = new SelectList(db.ACTIONs, "ID_ACTION", "LIBELLE", rEQUEST_TRAVEL.ID_ACTION); ViewBag.ID_TRAVEL = new SelectList(db.TRAVELs, "ID_TRAVEL", "ID_TRAVEL", rEQUEST_TRAVEL.ID_TRAVEL); ViewBag.ID_USER = new SelectList(db.USERs, "ID_USER", "FIRST_NAME", rEQUEST_TRAVEL.ID_USER); return(View(rEQUEST_TRAVEL)); }
// GET: RequestTravel/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } REQUEST_TRAVEL rEQUEST_TRAVEL = db.REQUEST_TRAVEL.Find(id); if (rEQUEST_TRAVEL == null) { return(HttpNotFound()); } return(View(rEQUEST_TRAVEL)); }
// GET: RequestTravel/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } REQUEST_TRAVEL rEQUEST_TRAVEL = db.REQUEST_TRAVEL.Find(id); if (rEQUEST_TRAVEL == null) { return(HttpNotFound()); } ViewBag.ID_ACTION = new SelectList(db.ACTIONs, "ID_ACTION", "LIBELLE", rEQUEST_TRAVEL.ID_ACTION); ViewBag.ID_TRAVEL = new SelectList(db.TRAVELs, "ID_TRAVEL", "ID_TRAVEL", rEQUEST_TRAVEL.ID_TRAVEL); ViewBag.ID_USER = new SelectList(db.USERs, "ID_USER", "FIRST_NAME", rEQUEST_TRAVEL.ID_USER); return(View(rEQUEST_TRAVEL)); }
public void add(REQUEST_TRAVEL request) { try { var Context = new connext_dbEntities(); Context.REQUEST_TRAVEL.Add(request); Context.SaveChanges(); } catch (Exception ex) { #if DEBUG throw new Exception("Impossible de modifier l'agence." + Environment.NewLine + ex.StackTrace); #else throw new Exception("Impossible de modifier l'agence."); #endif } }
public void remove(REQUEST_TRAVEL request) { try { var Context = new connext_dbEntities(); Context.REQUEST_TRAVEL.Remove(request); Context.SaveChanges(); } catch (Exception ex) { #if DEBUG throw new Exception("Impossible de supprimer le lieu." + Environment.NewLine + ex.StackTrace); #else throw new Exception("Impossible de supprimer le lieu."); #endif } }
public void modify(int id, int idaction) { try { var Context = new connext_dbEntities(); REQUEST_TRAVEL requesttravel = Context.REQUEST_TRAVEL.First(r => r.ID_REQUEST_TRAVEL == id); requesttravel.ID_ACTION = idaction; Context.SaveChanges(); } catch (Exception ex) { #if DEBUG throw new Exception("Impossible de modifier l'agence." + Environment.NewLine + ex.StackTrace); #else throw new Exception("Impossible de modifier l'agence."); #endif } }
// POST api/values public HttpResponseMessage Post(RequestTravelModel model) { if (HttpContext.Current.Request.Headers["Authorization"] == null) { throw new HttpResponseException(HttpStatusCode.Unauthorized); } REQUEST_TRAVEL objBdd = new REQUEST_TRAVEL(); objBdd.ID_TRAVEL = model.IdTravel; objBdd.ID_USER = model.IdUser; objBdd.ID_ACTION = 1; manager.add(objBdd); return(new HttpResponseMessage() { Content = new JsonContent(new { Success = true, //error Message = "Success" //return exception }) }); }