public RequestTravelModel(REQUEST_TRAVEL objBdd) { Id = objBdd.ID_REQUEST_TRAVEL; IdTravel = objBdd.ID_TRAVEL; IdUser = objBdd.ID_USER; IdAction = objBdd.ID_ACTION; }
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 } }
// 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 }) }; }
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 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 } }