public ActionResult ChangePassword([Bind(Include = "RID,AuthorityCode,RefugeeFName,RefugeeLName,Password,OldConfirmPassword,ConfirmNewPassword,NewPassword,Postcode,Email,Street,Suburb,State,Phone,Family_Description,Icon")] Refugee refugee) { newleavesdatabaseEntities1 db = new newleavesdatabaseEntities1(); if (refugee.OldConfirmPassword != null && refugee.NewPassword != null && refugee.NewPassword != null) { if (string.Compare(Crypto.Hash(refugee.OldConfirmPassword), refugee.Password) == 0) { if (ModelState.IsValid) { refugee.Password = refugee.NewPassword; refugee.Password = Crypto.Hash(refugee.Password); db.Entry(refugee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("RefugeeDetailsAfter", new { code = User.Identity.Name })); } } else { ViewData["Non"] = "The old password didn't match"; return(View("ChangePassword", refugee)); } } else { ViewData["Non"] = "Please fill all the boxes before submit."; return(View("ChangePassword", refugee)); } return(View()); }
public ActionResult Edit([Bind(Include = "RID,RefugeeFName,RefugeeLName,AuthorityCode,Password,Street,Suburb,State,Email,Postcode,Phone,Family_Description,Icon")] Refugee refugee) { if (ModelState.IsValid) { db.Entry(refugee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(refugee)); }
public ActionResult Edit([Bind(Include = "Item_ID,Item_Name,Category,Description,Estimated_Price,Icon")] Item item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Edit([Bind(Include = "DID,FirstName,LastName,Email,Password,IsEmailVerified,ActivationCode,Street,Suburb,State,Postcode,Phone,Icon")] Donor donor) { if (ModelState.IsValid) { donor.Password = Crypto.Hash(donor.Password); db.Entry(donor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(donor)); }
public ActionResult Create([Bind(Include = "DonationID,DID,Wish_List_ID,Item_Name,Donate_Date,Status")] Donation donation, int id) { Wish_List wish = db.Wish_List.Find(id); wish.Status = "In processing"; db.Entry(wish).State = EntityState.Modified; db.SaveChanges(); //return RedirectToAction("Index"); if (ModelState.IsValid) { db.Donation.Add(donation); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DID = new SelectList(db.Donor, "DID", "FirstName", donation.DID); ViewBag.Wish_List_ID = new SelectList(db.Wish_List, "Wish_List_ID", "Status", donation.Wish_List_ID); return(View(donation)); }
public ActionResult Edit([Bind(Include = "DonationID,DID,Wish_List_ID,Item_Name,Donate_Date,Status")] Donation donation) { if (ModelState.IsValid) { db.Entry(donation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DID = new SelectList(db.Donor, "DID", "FirstName", donation.DID); ViewBag.Wish_List_ID = new SelectList(db.Wish_List, "Wish_List_ID", "Status", donation.Wish_List_ID); return(View(donation)); }
public ActionResult Edit([Bind(Include = "Wish_List_ID,RID,Item_ID,Create_Date,Hope_Delivery_Date,Status,Description,AuthorityCode")] Wish_List wish_List) { if (ModelState.IsValid) { db.Entry(wish_List).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Item_ID = new SelectList(db.Item, "Item_ID", "Item_Name", wish_List.Item_ID); ViewBag.RID = new SelectList(db.Refugee, "RID", "RefugeeFName", wish_List.RID); return(View(wish_List)); }
public ActionResult Received(int id) { var username = User.Identity.Name; if (!string.IsNullOrEmpty(username)) { var user = db.Refugee.SingleOrDefault(u => u.AuthorityCode == username); string fullName = string.Concat(new string[] { user.RefugeeFName, " ", user.RefugeeLName }); ViewData.Add("FullName", fullName); } //delete the wishlist(make this record invisible) Wish_List wish_List = db.Wish_List.Find(id); wish_List.Status = "Completed"; db.Entry(wish_List).State = EntityState.Modified; db.SaveChanges(); //change information in donation table // Donation donation = wish_List.Donation.Where(d=>d.Wish_List_ID==id).FirstOrDefault(); // donation.Status = "Completed"; // db.Entry(donation).State = EntityState.Modified; // db.SaveChanges(); return(RedirectToAction("ShowWishList", new { code = User.Identity.Name })); }