// GET: Houses public ActionResult Index() { var vm = InitializeIndexView(); UsaHousesPageManager ObjUsaHousesPageManager = new UsaHousesPageManager(); //cod da decommentare con chiamata ad api //**************************************** List <UsaHouseDTO> LstUsaHouses = new List <UsaHouseDTO>(); List <UsaHouseDTO> LstUsaHousesWithDefault = new List <UsaHouseDTO>(); if (LoginUsr.role.Trim() == "INVESTOR") { LstUsaHouses = ObjUsaHousesPageManager.GetUSAHouses(LoginUsr.id.ToString()); } else { LstUsaHouses = ObjUsaHousesPageManager.GetUSAHouses(""); } foreach (UsaHouseDTO HouseObj in LstUsaHouses) { LstUsaHousesWithDefault.Add(SetDefaultForHouseDTO(HouseObj)); } vm.LstHouses = LstUsaHousesWithDefault; //**************************************** //vm.LstHouses = db.House.ToList(); return(View(vm)); // return View(db.House.ToList()); }
public ActionResult Create(Ls.Prj.Entity.House house) { // public ActionResult Create([Bind(Include = "Id,nickname,state,city,address,housePhoto,zillowLink,purchasePrice,sqFeet,sqFeetPrice,constructionYear,grossRent,percVacancy,extimateAccountingExpense,extimateCondoExpense,extimateInsuranceExpense,extimateMaintenanceExpense,extimateProperyManagerExpense,extimateUtilitiesExpense,extimatePestControlExpense,extimatePropertyTax,closingCosts,titleCompanyCosts,agencyCosts,otherClosingCosts,enabled")] Ls.Prj.Entity.House house) //{ var vm = InitializeIndexView(); UsaHousesPageManager ObjUsaHousesPageManager = new UsaHousesPageManager(); Ls.Prj.Entity.House ObjHouse = null; Ls.Prj.Entity.House HouseObj = SetDefaultForHouseEntity(house); if (ModelState.IsValid) { ObjHouse = ObjUsaHousesPageManager.NewUsaHouse(HouseObj); //db.House.Add(HouseObj); //db.SaveChanges(); return(RedirectToAction("Index")); } //Ls.Prj.Entity.House Casa = ObjUsaHousesPageManager.GetUsaHouse(ObjHouse.id); // House Casa = db.House.Find(house.Id); vm.House = house; //vm.House = new UsaHouseDTO(); return(View(vm)); }
public ActionResult Edit(Ls.Prj.Entity.House house) { // public ActionResult Edit([Bind(Include = "Id,nickname,state,city,street,housePhoto,zillowLink,purchasePrice,sqFeet,sqFeetPrice,constructionYear,grossRent,percVacancy,extimateAccountingExpense,extimateCondoExpense,extimateInsuranceExpense,extimateMaintenanceExpense,extimateProperyManagerExpense,extimateUtilitiesExpense,extimatePestControlExpense,extimatePropertyTax,closingCosts,titleCompanyCosts,agencyCosts,otherClosingCosts,enabled")] House house) //{ if (ModelState.IsValid) { UsaHousesPageManager ObjUsaHousesPageManager = new UsaHousesPageManager(); ObjUsaHousesPageManager.UpdateUsaHouse(house); //db.Entry(house).State = EntityState.Modified; //db.SaveChanges(); return(RedirectToAction("Index")); } return(View(house)); }
// GET: Houses/Details/5 public ActionResult Details(int?id) { var vm = InitializeIndexView(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UsaHousesPageManager UsaHousesPageManagerObj = new UsaHousesPageManager(); //Ls.Prj.Entity.House house = UsaHousesPageManagerObj.GetUsaHouse((int)id); UsaHouseDTO UsaHouseDTOObj = UsaHousesPageManagerObj.GetUsaHouseDTO((int)id); UsaHouseDTOObj = SetDefaultForHouseDTO(UsaHouseDTOObj); // house = SetDefaultForHouseEntity(house); //House house = db.House.Find(id); if (UsaHouseDTOObj == null) { return(HttpNotFound()); } RptHouseManagementManager ObjRptHouseManagementManager = new RptHouseManagementManager(); List <HouseReportDTO> LstRptDTO = new List <HouseReportDTO>(); LstRptDTO = ObjRptHouseManagementManager.GetReportsForHouses(UsaHouseDTOObj.Id.ToString()); // http://2.235.241.7:8080//houses/5/reports/years/2018 //********************* //codice vecchio //string report1 = Utility.ReadSetting("Re2017ApiUrl") + "/houses/" + UsaHouseDTOObj.Id + "/reports/years/2018"; // string report2 = Utility.ReadSetting("Re2017ApiUrl") + "/houses/" + UsaHouseDTOObj.Id + "/reports/years/2019"; //HouseReportDTO ObjHouseReportDTO1 = new HouseReportDTO(); //ObjHouseReportDTO1.reportUrl = report1; //ObjHouseReportDTO1.year = "2018"; //HouseReportDTO ObjHouseReportDTO2 = new HouseReportDTO(); //ObjHouseReportDTO2.reportUrl = report2; //ObjHouseReportDTO2.year = "2019"; //vm.ReportsUrl = new List<HouseReportDTO>() { ObjHouseReportDTO1, ObjHouseReportDTO2 }; ////********************* vm.ReportsUrl = LstRptDTO; vm.HouseDTO = UsaHouseDTOObj; //vm.House = house; return(View(vm)); //return View(house); }
// GET: Houses/Edit/5 public ActionResult Edit(int?id) { var vm = InitializeIndexView(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UsaHousesPageManager UsaHousesPageManagerObj = new UsaHousesPageManager(); Ls.Prj.Entity.House house = UsaHousesPageManagerObj.GetUsaHouse((int)id); //TODO:Da togliere!!! house = SetDefaultForHouseEntity(house); //House house = db.House.Find(id); if (house == null) { return(HttpNotFound()); } vm.House = house; //vm.House = new Ls.Prj.Entity.House(); return(View(vm)); //return View(house); }