Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        public IActionResult Create()
        {
            SuiteVM vm = new SuiteVM();

            return(View(vm));
        }