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));
        }
Пример #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));
 }
Пример #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());
        }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }