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 Delete(int HouseId) { iHouseEntities entities = new iHouseEntities(); House house = entities.Houses.Find(HouseId); //List<House> item = entities.Houses.Where(x => x.HouseId == HouseId & x.SellerId == SellerId).ToList(); entities.Houses.Remove(house); entities.SaveChanges(); return(RedirectToAction("Deleted")); }
public ActionResult Add(House house, int?SellerId) { if (ModelState.IsValid) { try { entities.Houses.Add(house); entities.SaveChanges(); //acknowledge message TempData["SuccessMsg"] = "Property has been successfully added"; return(RedirectToAction("Me", "MyProperty", new { SellerId = house.SellerId })); } catch { return(View(house)); } } return(View(house)); }
public ActionResult Register(Seller seller) { if (ModelState.IsValid) { try { entities.Sellers.Add(seller); entities.SaveChanges(); //Success acknowledge message TempData["SuccessMsg"] = "Successfully registered"; return(RedirectToAction("Me", "MyProperty", new { SellerId = seller.SellerId })); } catch { return(View("Index")); } } return(View("Index")); }