Beispiel #1
0
        public async Task <IActionResult> Putcostumer(int id, costumer costumer)
        {
            if (id != costumer.id)
            {
                return(BadRequest());
            }

            _context.Entry(costumer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!costumerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutPostInfo(int id, PostInfo postInfo)
        {
            if (id != postInfo.id)
            {
                return(BadRequest());
            }

            _context.Entry(postInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PostInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Putdata(string id, data data)
        {
            if (id != data.Location)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!dataExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Putaddress(int id, address address)
        {
            if (id != address.id)
            {
                return(BadRequest());
            }

            _context.Entry(address).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!addressExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count <= 0 && carUpdate == null)
            {
                return;
            }

            carUpdate.carBrand     = txtCarBrad.Text;
            carUpdate.carModel     = txtCarModel.Text;
            carUpdate.licensePlate = txtLicnPlate.Text;
            carUpdate.carType      = txtType.Text;
            carUpdate.gear         = txtGear.Text;
            carUpdate.fuel         = txtFuel.Text;
            carUpdate.carPic       = txtPicRL.Text;
            carUpdate.priceClass   = int.Parse(comboBox1.SelectedItem.ToString());

            db.Entry(db.Cars.Find(carUpdate.CarID)).CurrentValues.SetValues(carUpdate);
            db.SaveChanges();

            txtreset();
            carList();
        }
        public ActionResult Edit(designation dsg)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(dsg).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
                return(View(dsg));
            }
            catch
            {
                return(View());
            }
        }