public ActionResult Update(AddReservationVM item, Int32 hosted_at_id)
        {
            var hosted_at = db.hosted_at.FirstOrDefault(i => i.id == hosted_at_id);

            if (hosted_at != null)
            {
                hosted_at.guest.firstname = item.firstname;
                hosted_at.guest.lastname  = item.lastname;
                hosted_at.guest.gender    = item.gender;
                hosted_at.occupied_room.reservation.date_in  = Convert.ToDateTime(item.checkin);
                hosted_at.occupied_room.reservation.date_out = Convert.ToDateTime(item.checkout);
                hosted_at.occupied_room.room.id = item.room;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Save(AddReservationVM item)
        {
            var guest = db.guest.Add(new guest()
            {
                firstname = item.firstname, lastname = item.lastname, gender = item.gender, member_since = DateTime.Now
            });

            db.SaveChanges();

            var reservation = db.reservation.Add(new reservation()
            {
                date_in = Convert.ToDateTime(item.checkin), date_out = Convert.ToDateTime(item.checkout), made_by = ((Session["user"] as Models.user).id), guest_id = guest.id
            });

            db.SaveChanges();

            var occupied_room = db.occupied_room.Add(new occupied_room()
            {
                check_in     = new TimeSpan()
                {
                }, check_out = new TimeSpan()
                {
                }, room_id   = item.room, reservation_id = reservation.id
            });

            db.SaveChanges();

            var hosted_at = db.hosted_at.Add(new hosted_at()
            {
                guest_id = guest.id, occupied_room_id = occupied_room.id
            });

            db.SaveChanges();

            return(RedirectToAction("Index"));
        }