public IActionResult Edit(long id) { Suite suite = this.db.Suites .Where(x => x.Id == id) .FirstOrDefault(); SuiteVM vm = new SuiteVM(); vm.Tipo = suite.Tipo; vm.QtCamaCasal = suite.QtCamaCasal; vm.QtCamaSolteiro = suite.QtCamaSolteiro; return(View(vm)); }
public IActionResult Edit(long id, SuiteVM vm) { if (ModelState.IsValid) { Suite suiteDb = this.db.Suites.Find(id); suiteDb.Tipo = vm.Tipo; suiteDb.QtCamaCasal = vm.QtCamaCasal; suiteDb.QtCamaSolteiro = vm.QtCamaSolteiro; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vm)); }
public IActionResult Create(SuiteVM vm) { if (ModelState.IsValid) { Suite suite = new Suite(); suite.Tipo = vm.Tipo; suite.QtCamaCasal = vm.QtCamaCasal; suite.QtCamaSolteiro = vm.QtCamaSolteiro; this.db.Suites.Add(suite); this.db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vm)); }
public IActionResult Create() { SuiteVM vm = new SuiteVM(); return(View(vm)); }