//Get request for romemate finder
        public ActionResult EditRequest(int id = 0)
        {
            AccountDbContext db   = new AccountDbContext();
            RoommateDatabase user = db.rommateDatabase.Single(us => us.ID == id);

            return(View(user));
        }
//      public ActionResult RoomateRequest(RoommateDatabase roommateDatabase)
        public ActionResult RoomateRequest(FormCollection formCollection)
        {
            if (ModelState.IsValid)
            {
                RoommateDatabase rd = new RoommateDatabase();
                rd.Name                   = formCollection["Name"];
                rd.PartnerGender          = formCollection["PartnerGender"];
                rd.SelectOptionForPartner = formCollection["SelectOptionForPartner"];
                rd.Location               = formCollection["Location"];
                rd.MessageMail            = formCollection["MessageMail"];
                rd.Requested_Date         = Convert.ToDateTime(formCollection["Requested_Date"]);

                int currentUserID = 0;
                currentUserID = Convert.ToInt32(Session["UserId"].ToString());
                rd.UserID     = currentUserID;

                AccountDbContext db = new AccountDbContext();
                db.rommateDatabase.Add(rd);
                db.SaveChanges();
                ViewBag.MessageReq = rd.Name + " you have successfully posted a new request.";
                ModelState.Clear();
                // SendActivationEmail(account.UserId); // Send email for query
            }
            return(View());
        }
        public ActionResult DeleteConfirmed(int id = 0)
        {
            AccountDbContext db   = new AccountDbContext();
            RoommateDatabase user = db.rommateDatabase.Single(us => us.ID == id);

            db.rommateDatabase.Remove(user);
            db.SaveChanges();
            return(RedirectToAction("UserRequestsForRoommate", "Database"));
        }
        // GET: /User/Delete/for Roommate finder
        public ActionResult DeleteRequest(int id = 0)
        {
            AccountDbContext db   = new AccountDbContext();
            RoommateDatabase user = db.rommateDatabase.Single(us => us.ID == id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            return(View(user));
        }
        public ActionResult ContactRequester(int id = 0)
        {
            AccountDbContext db   = new AccountDbContext();
            RoommateDatabase user = db.rommateDatabase.Single(us => us.ID == id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            SecondUserSendMessage abc = new SecondUserSendMessage();

            abc.roommateDB  = user;
            abc.sendMessage = new SendMessage();
            return(View("ContactRequester", abc));
        }
        [ActionName("EditRequest")] // for roommate finder
        public ActionResult EditRequest_post(int id)
        {
            AccountDbContext db   = new AccountDbContext();
            RoommateDatabase user = db.rommateDatabase.Single(us => us.ID == id);

            if (ModelState.IsValid)
            {
                UpdateModel(user, new string[] { "Name", "SelectOptionForPartner", "PartnerGender", "Location", "MessageMail", "Requested_Date", "UserID" });
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                ModelState.Clear();
                ViewBag.MessageReq = "Details saved successfully.";
            }

            return(View(user));
        }