Exemplo n.º 1
0
        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"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            iHouseEntities entities = new iHouseEntities();

            ViewBag.List = entities.Houses.OrderByDescending(x => x.HouseId).ToList();
            return(View());
        }
Exemplo n.º 3
0
        //GET:MyProperty/MyProperty
        public ActionResult MyProperty(int SellerId, string Email)
        {
            iHouseEntities entities   = new iHouseEntities();
            MyProperty     MyProperty = new MyProperty();

            MyProperty.sellers = entities.Sellers.Where(x => x.SellerId == SellerId & x.Email == Email).ToList();
            MyProperty.houses  = entities.Houses.Where(a => a.SellerId == SellerId).ToList();
            return(View(MyProperty));
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        public ActionResult Index(string Region, string Suburb, string Type)
        {
            if (Region == null && Suburb == null && Type == null)
            {
                TempData["SeachFailed"] = "Please input at least one search condition";
                return(View());
            }
            iHouseEntities entities     = new iHouseEntities();
            List <House>   SearchResult = entities.Houses
                                          .Where(x => x.Region.Contains(Region) & x.Suburb.Contains(Suburb) & x.Type.Contains(Type))
                                          .OrderByDescending(x => x.HouseId)
                                          .ToList();

            ViewBag.List = SearchResult;
            return(View());
        }