public IHttpActionResult PutCountry(int id, Country country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "id,ToUserName,FromUserName,CreateTime,MsgType")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
 public ActionResult Edit([Bind(Include = "Id")] TempModel tempModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tempModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tempModel));
 }
Beispiel #4
0
        public IHttpActionResult PutRent(Rent rent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public Employee Edit(Employee employee)
 {
     _dbContext.Entry(employee).State = EntityState.Modified;
     _dbContext.SaveChanges();
     return(employee);
 }
 public virtual void Update(T entity)
 {
     dbset.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }