Esempio n. 1
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            InnCode innCode = await db.Inncodes.FindAsync(id);

            db.Inncodes.Remove(innCode);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <ActionResult> Edit([Bind(Include = "HotelInnCode,HotelName,HotelAddress,HotelPhoneNumber,HasSpa,HasGolfCourse,HasRooftopBar,NumberOfStars")] InnCode innCode)
        {
            if (ModelState.IsValid)
            {
                db.Entry(innCode).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(innCode));
        }
Esempio n. 3
0
        // GET: InnCodes/Delete/5
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InnCode innCode = await db.Inncodes.FindAsync(id);

            if (innCode == null)
            {
                return(HttpNotFound());
            }
            return(View(innCode));
        }
Esempio n. 4
0
        public bool CreateInnCode(InnCodeCreate model)
        {
            var entity =
                new InnCode()
            {
                HotelInnCode     = model.HotelInnCode,
                HotelName        = model.HotelName,
                HotelAddress     = model.HotelAddress,
                HotelPhoneNumber = model.HotelPhoneNumber,
                NumberOfStars    = model.NumberOfStars,
                HasGolfCourse    = model.HasGolfCourse,
                HasRooftopBar    = model.HasRooftopBar,
                HasSpa           = model.HasSpa,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Inncodes.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }