Ejemplo n.º 1
0
        /// <summary>
        /// Create a new Vehical object.
        /// </summary>
        /// <param name="vehicalID">Initial value of the VehicalID property.</param>
        public static Vehical CreateVehical(global::System.Int32 vehicalID)
        {
            Vehical vehical = new Vehical();

            vehical.VehicalID = vehicalID;
            return(vehical);
        }
Ejemplo n.º 2
0
        // POST api/VehicalAPI
        public HttpResponseMessage PostVehical(Vehical vehical)
        {
            if (ModelState.IsValid)
            {
                db.Vehicals.AddObject(vehical);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, vehical);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = vehical.VehicalID }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
Ejemplo n.º 3
0
        // PUT api/VehicalAPI/5
        public HttpResponseMessage PutVehical(int id, Vehical vehical)
        {
            if (ModelState.IsValid && id == vehical.VehicalID)
            {
                db.Vehicals.Attach(vehical);
                db.ObjectStateManager.ChangeObjectState(vehical, System.Data.EntityState.Modified);

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Vehicals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVehicals(Vehical vehical)
 {
     base.AddObject("Vehicals", vehical);
 }
 /// <summary>
 /// Create a new Vehical object.
 /// </summary>
 /// <param name="vehicalID">Initial value of the VehicalID property.</param>
 public static Vehical CreateVehical(global::System.Int32 vehicalID)
 {
     Vehical vehical = new Vehical();
     vehical.VehicalID = vehicalID;
     return vehical;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Vehicals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVehicals(Vehical vehical)
 {
     base.AddObject("Vehicals", vehical);
 }