public ActionResult Edit(Unit unit) { if (ModelState.IsValid) { db.Entry(unit).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(unit); }
public void UpdateUnit(Unit unit) { DeleteUnit(unit.UnitId); InsertUnit(unit); }
public void InsertUnit(Unit unit) { MyUnits.Add(unit); }
public Unit FirstUnit() { var firstUnitId = new Int32(); var firstUnit = new Unit { UnitId = firstUnitId , Bed = new Int32() , Bathroom = new Double() , SquareFoot = new Double() , Lot = new Double(), TypeId = new Int32(), YearBuilt = new DateTime(), YearRemodeled = new DateTime(), Description = null, PrimaryPhoto = null, Address = null, GoogleMap = null, Country = null, State = null, Region = null, City = null, Zip = null, CountryCode = null, NumberofPhoto = new Int32(), Price = new Double(), Currency = null, CurrencyCode = new Int32(), ParkingSpaceId = new Int32(), GarageSizeId = new Int32(), DaysOnSite = new Int32(), FloorId = new Int32(), AvailableDate = new DateTime(), PosterRole = null, PosterID = new Int32(), YouTubeVideo = new Boolean(), YouTubeVideoURL = null, VimeoVideo = new Boolean(), VimeoVideoURL = null, Title = null, UnitAppliance = new UnitAppliance() , UnitCommunityAmenity = new UnitCommunityAmenity() , UnitExteriorAmenity = new UnitExteriorAmenity() , UnitFeature = new UnitFeature() , //Skipping UnitGallery Collection UnitInteriorAmenity = new UnitInteriorAmenity() , UnitLuxuryAmenity = new UnitLuxuryAmenity() , UnitPricing = new UnitPricing { UnitId = firstUnitId, Rent = 50 } }; return firstUnit; }
public void UpdateUnit(Unit unit) { _context.Entry(unit).State = EntityState.Modified; }
public void InsertUnit(Unit unit) { _context.Units.Add(unit); }
public void SetUp() { var firstUnitAppliance = new UnitAppliance { UnitId = 1, Range_Oven = true, Full_Refrigerator = false, Dishwasher = true, Sink_Disposal = false, Microwave = false, Central_Vacuum = false, Surround_Sound = false, Wine_Fridge = false, Washer___Dryer_in_Unit = false, Washer_Dryer_Connections = false, Shared_Laundry_Facility = false }; var firstUnit = new Unit { UnitId = 1, Bed = 1, Bathroom = 3, SquareFoot = 2000, Lot = null, TypeId = 2, YearBuilt = Convert.ToDateTime("5/5/2001"), YearRemodeled = null, Description = "First Home Ever", PrimaryPhoto = "none", Address = "Kansas Address", GoogleMap = "", Country = "USA", State = "KS", Region = "Overland Park", City = "Olathe", Zip = "", CountryCode = "US", NumberofPhoto = 0, Price = 100, Currency = "Dollars", CurrencyCode = 1, ParkingSpaceId = 1, GarageSizeId = 1, DaysOnSite = 2, FloorId = null, AvailableDate = Convert.ToDateTime("5/5/2001"), PosterRole = "CUS", PosterID = 100, YouTubeVideo = true, YouTubeVideoURL = "http://www.video.com", VimeoVideo = true, VimeoVideoURL = "http:sdfsd", Title = "fist Home", UnitCommunityAmenity = new UnitCommunityAmenity { UnitId = 1, Neighborhood_Name = "No Name", Elementary_School = "no Name", High_School = "no Name", School_District = "Shawnee", Middle_School = "no", County_Name = "Mission", Assisted_Living_Community = false, Over_55_Active_Community = false, Disability_Access = false, Controlled_Access = false, Community_Pool = false }, UnitFeature = new UnitFeature { UnitId = 1, High_Speed_Internet_Access = false, Internet_Included = false, Wireless_Internet_Access = false, Some_Paid_Utilities = false, Covered_Parking = false, Pets_allowed = false, Cats_Allowed = false, Small_Dogs = false, Large_Dogs = false, Alarm_system = false, Near_Transportation = false, Short_Term_Lease_Available = false, RV_Parking = false, Boat_Storage = false }, UnitGalleries = new List<UnitGallery>() { new UnitGallery { UnitGalleryId = 1, Path = "none", Caption = "none", Rank = 1, UnitId = 1, }, new UnitGallery { UnitGalleryId = 2, Path = "none", Caption = "none", Rank = 2, UnitId = 1, } }, UnitInteriorAmenity = new UnitInteriorAmenity { UnitId = 1, CoolingTypeId = 1, HeatingTypeId = 1, Fireplace = false, Hot_Tub_Spa = false, Cable_Ready = false, Attic = false, BasementTypeId = 1, Double_Pane_Storm_Windows = false, FloorCoveringId = 1, FoundationTypeId = 1, Kitchen_Island = false, Vaulted_Ceiling = false, Ceiling_Fan = false, Jetted_Tub = false, Floor = 1 }, UnitLuxuryAmenity = new UnitLuxuryAmenity { UnitId = 1, Tennis_Court = false, Security_System = false, Sports_Court = false, Basketball_Court = false, Fitness_Center = false, Barbecue = false, Elevator = false, Porch = false, Sauna = false, Skylight = false, Intercom = false, Waterfront = false, Wet_Bar = false, Doorman = false, Solar_Heat = false, Solar_Plumbing = false, Solar_Screens = false }, UnitPricing = new UnitPricing { UnitId = 1, Rent = 850, CurrencyId = 1, AvailableDate = DateTime.Today.Date, Deposit = 850, ApplicationFee = 35, Section_8_Eligible = false }, UnitExteriorAmenity = new UnitExteriorAmenity { UnitId = 1, Pool = false, Garden = false, Gated_Entry = false, Greenhouse = false, Lawn = false, Deck = false, Dock = false, Fenced_Yard = false, Sprinkler_System = false, Patio = false, Pond = false }, UnitAppliance = firstUnitAppliance }; MyUnits = new List<Unit> { firstUnit }; foreach (var myUnit in MyUnits) { Db.Units.Add(myUnit); } }