public async Task <IHttpActionResult> PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,Username,Password,Email,Phone,Code,Status")] Users users)
 {
     if (ModelState.IsValid)
     {
         db.Entry(users).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(users));
 }
Esempio n. 3
0
        public IHttpActionResult PutOoredo(int id, Ooredo ooredo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ooredo.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IActionResult> PutMyTable(int id, MyTable myTable)
        {
            if (id != myTable.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "Id,x,y,address,title")] Ooredo ooredo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ooredo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ooredo));
 }
 public ActionResult Edit([Bind(Include = "YazarId,YazarAdiSoyadi,YazarDogumTarihi")] Yazar yazar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(yazar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(yazar));
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "Id,A")] Class1 class1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(class1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(class1));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "PersonID,FirstName,LastName")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "EmployeeId,FirstName,LastName,Email")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
Esempio n. 10
0
 public ActionResult Edit([Bind(Include = "dataId,descriere")] Data data)
 {
     if (ModelState.IsValid)
     {
         db.Entry(data).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.dataId = new SelectList(db.Vanzares, "vanzareId", "vanzareId", data.dataId);
     return(View(data));
 }
Esempio n. 11
0
 public ActionResult Edit([Bind(Include = "clientId,descriere")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.clientId = new SelectList(db.Vanzares, "vanzareId", "vanzareId", client.clientId);
     return(View(client));
 }
Esempio n. 12
0
 public ActionResult Edit([Bind(Include = "locatieId,descriere")] Locatie locatie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(locatie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.locatieId = new SelectList(db.Vanzares, "vanzareId", "vanzareId", locatie.locatieId);
     return(View(locatie));
 }
Esempio n. 13
0
 public ActionResult Edit([Bind(Include = "produsId,descriere")] Produs produs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(produs).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.produsId = new SelectList(db.Vanzares, "vanzareId", "vanzareId", produs.produsId);
     return(View(produs));
 }
Esempio n. 14
0
 public ActionResult Edit([Bind(Include = "vanzareId,produsId,locatieId,dataId,clientId,pret,cantitate")] Vanzare vanzare)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vanzare).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.vanzareId = new SelectList(db.Clients, "clientId", "descriere", vanzare.vanzareId);
     ViewBag.vanzareId = new SelectList(db.Data, "dataId", "descriere", vanzare.vanzareId);
     ViewBag.vanzareId = new SelectList(db.Locaties, "locatieId", "descriere", vanzare.vanzareId);
     ViewBag.vanzareId = new SelectList(db.Produs, "produsId", "descriere", vanzare.vanzareId);
     return(View(vanzare));
 }