public ActionResult DeleteConfirmed(int id) { Deposited deposited = db.Depositeds.Find(id); Koda koda = db.Kodas.Find(deposited.kodasID); --koda.PeopleDeposited; db.Entry(koda).State = EntityState.Modified; db.Depositeds.Remove(deposited); db.SaveChanges(); return(RedirectToAction("Index/" + deposited.kodasID)); }
// GET: Depositeds/Details/5 public ActionResult Details() { //To prevent back browser button myLibrary.PreventBackButtonBrowser(Response); if (Convert.ToInt32(Session["flag"]) == 0) { return(RedirectToAction("Create", "Depositeds")); } //********************************************************// Deposited deposited = (Deposited)TempData["DepositeInfo"]; ViewBag.count = 0; var attend = db.Depositeds.Where(m => m.NationalID == deposited.NationalID).Select(m => m.AttendedOn); foreach (DateTime item in attend) { if ((DateTime.Now - item).TotalDays < 30) { ViewBag.count++; } } if (ViewBag.count > 0) { ViewBag.repeat = "عذراً ولكن لا يمكنك الحضور لأنك حضرت منذ فتره قريبه"; // ViewBag.disaple = disapled; } else { ViewBag.repeat = "نأسف ولكن لا يوجد مواعيد متاحة"; } //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} //Deposited deposited = db.Depositeds.Find(id); //if (deposited == null) //{ // return HttpNotFound(); //} var name = db.Churches.Find(deposited.churchesID).churchName; //TempData["churchID"] = deposited.churchesID; TempData["churchName"] = Convert.ToString(name); TempData["natID"] = deposited.NationalID; TempData["full"] = deposited.fullName; TempData["koID"] = deposited.kodasID; ViewBag.kodasList = db.Kodas.Where(k => (k.PeopleCount - k.PeopleDeposited) > 0 && k.ChurchesID == deposited.churchesID).ToList(); //ViewBag.KodasList = new SelectList(kodasList, "Id", "kodasDateAndTime"); return(View(deposited)); }
public ActionResult Edit([Bind(Include = "Id,NationalID,fullName,kodasID,AttendedOn,FatherID,churchesID,NumberFriends")] Deposited deposited) { if (ModelState.IsValid) { db.Entry(deposited).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.churchesID = new SelectList(db.Churches, "Id", "churchName", deposited.churchesID); ViewBag.FatherID = new SelectList(db.Logins, "Id", "Phone", deposited.FatherID); ViewBag.kodasID = new SelectList(db.Kodas, "Id", "Id", deposited.kodasID); return(View(deposited)); }
public ActionResult Create([Bind(Include = "Id,NationalID,fullName,churchesID")] Deposited deposited) { Session["flag"] = 1; if (ModelState.IsValid) { TempData["DepositeInfo"] = deposited; //db.Depositeds.Add(deposited); //db.SaveChanges(); return(RedirectToAction("Details")); } ViewBag.churchesID = new SelectList(db.Churches, "Id", "churchName", deposited.churchesID); //ViewBag.FatherID = new SelectList(db.Logins, "Id", "Phone", deposited.FatherID); //ViewBag.kodasID = new SelectList(db.Kodas, "Id", "Id", deposited.kodasID); return(View(deposited)); }
// GET: Depositeds/Edit/5 public ActionResult Edit(int?id) { //To prevent back browser button myLibrary.PreventBackButtonBrowser(Response); if (Session["id"] == null) { return(RedirectToAction("signIn", "Logins")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Deposited deposited = db.Depositeds.Find(id); if (deposited == null) { return(HttpNotFound()); } ViewBag.churchesID = new SelectList(db.Churches, "Id", "churchName", deposited.churchesID); ViewBag.FatherID = new SelectList(db.Logins, "Id", "Phone", deposited.FatherID); ViewBag.kodasID = new SelectList(db.Kodas, "Id", "Id", deposited.kodasID); return(View(deposited)); }
public ActionResult DetailsPost([Bind(Include = "kodasID")] Deposited deposited) { Session["flag"] = 0; if (TempData["natID"] == null) { return(Redirect("index")); } Koda koda = db.Kodas.Find(deposited.kodasID); deposited.NationalID = TempData["natID"] + ""; deposited.fullName = TempData["full"] + ""; deposited.churchesID = koda.ChurchesID; deposited.AttendedOn = koda.Date; deposited.FatherID = koda.fatherID; Koda k = db.Kodas.Where(m => m.Id == deposited.kodasID).FirstOrDefault(); k.PeopleDeposited++; db.Entry(koda).State = EntityState.Modified; db.Depositeds.Add(deposited); db.SaveChanges(); TempData["natID"] = null; TempData["dep"] = "تم التسجيل بنجاح"; return(Redirect("Create")); }
public BankAccountState Apply(Deposited evnt) { Balance += evnt.Amount; return(this); }
void IEventHandler <Deposited> .Handle(Deposited evnt) { Balance += evnt.Amount; }
void IEventHandler <Deposited> .Handle(Deposited evnt) { Console.WriteLine(evnt.Description); }
private void OnMoneyDeposited(Deposited e) { replyTo.Tell(new TransferSucceed(PersistenceId)); Context.Stop(Self); }