public IHttpActionResult PutClient(string id, Client client)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != client.Hostname)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "NIF,Nom,Cognom,DataNaixement,Carrer,Numero,Poblacio,Provincia,CP,Tlf,Correu,Aut")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
 public ActionResult Edit([Bind(Include = "ID,LastName,FirstName,Gender,DateOfBirth,Company,PolicyNumber,IssueState,FaceAmount")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "ClientID,ClientName,CNP,address")] ClientModel clientmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientmodel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clientmodel));
 }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Email")] Client client)
        {
            if (ModelState.IsValid)
            {
                db.Entry(client).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(client));
        }
Ejemplo n.º 7
0
 public int Put(int id, Clients client)
 {
     using (ClientDBContext dbContext = new ClientDBContext())
     {
         var client1 = dbContext.Clients.Find(id);
         client1.first_name             = client.first_name;
         client1.last_name              = client.last_name;
         client1.birth_day              = client.birth_day;
         dbContext.Entry(client1).State = System.Data.Entity.EntityState.Modified;
         return(dbContext.SaveChanges());
     }
 }
Ejemplo n.º 8
0
        public async Task <IActionResult> PutClient(int id, Client client)
        {
            client.id = id;

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

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

            return(NoContent());
        }