public ActionResult Create([Bind(Include = "ResidenceID,ResidenceTypeID,Location,Image,CheckIn,CheckOut,Price,Visit,ShortDescription,Text,CreateDate,Tag")] Residence residence, HttpPostedFileBase imgResidence)
        {
            if (ModelState.IsValid)
            {
                residence.Visit      = 0;
                residence.CreateDate = DateTime.Now;
                residence.CheckIn    = DateTime.Now.ToString();
                residence.CheckOut   = DateTime.Now.ToString();
                if (imgResidence != null)
                {
                    residence.Image = Guid.NewGuid() + Path.GetExtension(imgResidence.FileName);
                    imgResidence.SaveAs(Server.MapPath("/ResidenceImages/" + residence.Image));
                }
                residenceRepository.InsertResidence(residence);
                residenceRepository.Save();
                return(RedirectToAction("Index"));
            }

            ViewBag.ResidenceTypeID = new SelectList(residenceTypeRepository.GetAllResidenceTypes(), "ResidenceTypeID", "ResidenceKind", residence.ResidenceTypeID);
            return(View(residence));
        }
        public ActionResult ShowResidenceDetail(int id)
        {
            var residenceDetails = residenceRepository.GetResidenceById(id);

            if (residenceDetails == null)
            {
                return(HttpNotFound());
            }

            residenceDetails.Visit += 1;
            residenceRepository.UpdateResidence(residenceDetails);
            residenceRepository.Save();

            return(View(residenceDetails));
        }