public ActionResult Edit(PropertyEditView property)
 {
     if (ModelState.IsValid)
     {
         if (!PhoneExist(property.PhoneNumber))
         {
             Property toupdate = uow.PropertyRepository.GetByID(property.PropertyId);
             if (toupdate == null)
             {
                 TempData["result"] = "无法获取单元信息,操作失败!请联系管理员!";
                 return RedirectToActionPermanent("Index", "District", null);
             }
             toupdate.Active = property.Active;
             toupdate.Balance = property.Balance;
             toupdate.Notes = property.Notes;
             toupdate.NumberOfResidents = property.NumberOfResidents;
             toupdate.PhoneNumber = property.PhoneNumber;
             toupdate.PropertyNumber = property.PropertyNumber;
             toupdate.Sold = property.Sold;
             uow.PropertyRepository.Update(toupdate);
             uow.Save();
             Property p = uow.PropertyRepository.Get(pp => pp.PropertyId == property.PropertyId, null, "Block").FirstOrDefault();
             TempData["result"] = "单元信息修改成功!";
             return RedirectToAction("Details", "Block", new { id = p.Block.BlockId });
         }
         else
         {
             ModelState.AddModelError("", "该电话号码已被注册,请重新输入。");
         }
     }
     return View(property);
 }
        // GET: /Property/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Property property = uow.PropertyRepository.Get(p => p.PropertyId == id, null, "Block").FirstOrDefault();

            if (property == null)
            {
                return HttpNotFound();
            }
            PropertyEditView ppt = new PropertyEditView();
            ppt.Active = property.Active;
            ppt.Balance = property.Balance;
            ppt.BlockId = property.Block.BlockId;
            ppt.Notes = property.Notes;
            ppt.NumberOfResidents = property.NumberOfResidents;
            ppt.PhoneNumber = property.PhoneNumber;
            ppt.PropertyId = property.PropertyId;
            ppt.PropertyNumber = property.PropertyNumber;
            ppt.Sold = property.Sold;

            return View(ppt);
        }