public async Task <IActionResult> PutCityItem(long id, CityItem cityItem)
        {
            if (id != cityItem.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,ReviewId,UserId")] ReviewLike reviewLike)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reviewLike).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ReviewId = new SelectList(db.Reviews, "Id", "UserId", reviewLike.ReviewId);
     return(View(reviewLike));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,CategoryId,Name,Address,Website,Phone")] Facility facility)
 {
     if (ModelState.IsValid)
     {
         db.Entry(facility).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", facility.CategoryId);
     return(View(facility));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,FacilityId,UserId,Rating,Text,Release")] Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FacilityId = new SelectList(db.Facilities, "Id", "Name", review.FacilityId);
     return(View(review));
 }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,ParentId,Name")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParentId = new SelectList(db.Categories, "Id", "Name", category.ParentId);
     return(View(category));
 }
Ejemplo n.º 6
0
        public ActionResult Edit([Bind(Include = "Id,ReviewId,Image")] ReviewImage reviewImage)
        {
            HttpPostedFileBase file = Request.Files["Image"];

            if (file != null && file.ContentLength > 0)
            {
                reviewImage.Image = file.FileName;
            }
            ModelState.Clear();
            TryValidateModel(reviewImage);
            if (ModelState.IsValid)
            {
                file.SaveAs(HttpContext.Server.MapPath("~/Images/" + reviewImage.Image));

                db.Entry(reviewImage).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ReviewId = new SelectList(db.Reviews, "Id", "Text", reviewImage.ReviewId);
            return(View(reviewImage));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> PutCity(int id, City city)
        {
            if (id != city.Id)
            {
                return(BadRequest());
            }

            try
            {
                city.Validate();
            }
            catch (InvalidOperationException e)
            {
                return(Problem(title: "Erro ao editar usuário!", detail: e.Message, statusCode: 400));
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 8
0
 public ActionResult Edit_pilot(Pilot pilot)
 {
     db.Entry(pilot).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index_pilot"));
 }
Ejemplo n.º 9
0
 public ActionResult Edit(City city)
 {
     db.Entry(city).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }