public ActionResult Update(int HouseId, //int SellerId, string Region, string Suburb, string Location, //string Type, int Room, decimal FloorArea, decimal LandArea, //decimal RV, string Email, House house) { try { iHouseEntities entities = new iHouseEntities(); //var item = entities.Houses.First(x => x.HouseId == HouseId); //item.HouseId = HouseId; //item.SellerId = SellerId; //item.Region = Region; //item.Suburb = Suburb; //item.Location = Location; //item.Type = Type; //item.Room = Room; //item.FloorArea = FloorArea; //item.LandArea = LandArea; //item.RV = RV; //item.Email = Email; entities.Entry(house).State = EntityState.Modified; entities.SaveChanges(); return(RedirectToAction("UpdateSucceed")); } catch { return(RedirectToAction("UpdateFailed")); } }
public ActionResult Update(int?id, int SellerId, House house) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { entities.Entry(house).State = EntityState.Modified; entities.SaveChanges(); //acknowledge message TempData["SuccessMsg"] = "Property has been successfully updated"; return(RedirectToAction("Me", "MyProperty", new { SellerId = house.SellerId })); } return(View(house)); }
public ActionResult Update(int?SellerId, Seller seller) { if (ModelState.IsValid) { try { entities.Entry(seller).State = EntityState.Modified; entities.SaveChanges(); //acknowledge message TempData["SuccessMsg"] = "Your information has been successfully updated"; return(RedirectToAction("Me", "MyProperty", new { SellerId = seller.SellerId })); } catch { return(View()); } } return(View()); }