public IHttpActionResult PutVehicleDataTable(int id, VehicleDataTable vehicleDataTable) //UPDATE U BAZI ZA NEKI OBJEKT BAZE
        {
            //if (!ModelState.IsValid) //Ovo u Angularu napravio
            //{
            //    return BadRequest(ModelState);
            //}

            if (id != vehicleDataTable.VehicleID)
            {
                return(BadRequest());
            }

            db.Entry(vehicleDataTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VehicleDataTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));//ako sve prodje oke
        }
예제 #2
0
            public override global::System.Data.DataTable Clone()
            {
                VehicleDataTable cln = ((VehicleDataTable)(base.Clone()));

                cln.InitVars();
                return(cln);
            }
예제 #3
0
 private void InitClass()
 {
     this.DataSetName             = "VehicleManual";
     this.Prefix                  = "";
     this.Namespace               = "http://tempuri.org/VehicleManual.xsd";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableVehicle            = new VehicleDataTable();
     base.Tables.Add(this.tableVehicle);
 }
예제 #4
0
 internal void InitVars(bool initTable)
 {
     this.tableVehicle = ((VehicleDataTable)(base.Tables["Vehicle"]));
     if ((initTable == true))
     {
         if ((this.tableVehicle != null))
         {
             this.tableVehicle.InitVars();
         }
     }
 }
        public IHttpActionResult PostVehicleDataTable(VehicleDataTable vehicleDataTable) //SLUZI ZA UNOS NOVOG VOZILA
        {
            //if (!ModelState.IsValid) //ISTO NAPRAVIO U ANGULARU
            //{
            //    return BadRequest(ModelState);
            //}

            db.VehicleDataTable.Add(vehicleDataTable); //PRVA VAZNA
            db.SaveChanges();                          //DRUGA VAZNA

            return(CreatedAtRoute("DefaultApi", new { id = vehicleDataTable.VehicleID }, vehicleDataTable));
        }
        public IHttpActionResult DeleteVehicleDataTable(int id) //ZA DELETE
        {
            VehicleDataTable vehicleDataTable = db.VehicleDataTable.Find(id);

            if (vehicleDataTable == null)
            {
                return(NotFound());
            }

            db.VehicleDataTable.Remove(vehicleDataTable);
            db.SaveChanges();

            return(Ok(vehicleDataTable));
        }
예제 #7
0
 internal VehicleRow(global::System.Data.DataRowBuilder rb) :
     base(rb)
 {
     this.tableVehicle = ((VehicleDataTable)(this.Table));
 }