public ActionResult Marriage(Marriage marriage) { if (ModelState != null) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var result1 = db.Marriages.Where(a => a.Email == marriage.Email).FirstOrDefault(); if (result1 != null) { ViewBag.Feedback = "Record Already Exist."; return(RedirectToAction("Marriage")); } db.SaveChanges(); var result = db.Citizens.Single(a => a.Email == marriage.Email); db.SaveChanges(); if (result == null) { return(View()); } marriage.CitizenId = result.CitizenId; db.Marriages.Add(marriage); db.SaveChanges(); ModelState.Clear(); ViewBag.Feedback = "Successfully Registered."; } } return(View()); }
public ActionResult EditDeath(Death emp) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var emp1 = db.Deaths.Where(row => row.Id == emp.Id).FirstOrDefault(); if (emp1 == null) { return(RedirectToAction("RegisteredDeath")); } emp1.Id = emp.Id; emp1.Occupation = emp.Occupation; emp1.AmountPaid = emp.AmountPaid; emp1.NameOfDeceased = emp.NameOfDeceased; emp1.DateOfDeath = emp.DateOfDeath; emp1.PlaceOfDeath = emp.PlaceOfDeath; emp1.Email = emp.Email; int res = db.SaveChanges(); if (res > 0) { ViewBag.Message = "Successfully Updated"; } } return(View()); }
public ActionResult BirthReceipt(int?id) { if (!this.AuthenticateUser()) { return(RedirectToAction("Index")); } if (id == null || id == 0) { return(RedirectToAction("Birth")); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var result1 = db.Births.Single(a => a.Id == id); if (result1 == null) { return(RedirectToAction("Birth")); } var result = db.Citizens.Single(a => a.Email == result1.Email); if (result == null) { return(RedirectToAction("Birth")); } Session["BirthInfo"] = result1; } return(View()); }
public ActionResult Report() { List <Report> report = new List <Report>(); using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var rep = db.Licenses.ToList(); if (rep == null) { return(RedirectToAction("License")); } ViewBag.Message = rep.Count(); rep.Reverse(); for (int i = 0; i < rep.Count; i++) { Report repInfo = new Models.Report(); var rp = rep[i]; var citizenInfo = db.Citizens.SingleOrDefault(r => r.Email == rp.Email); if (citizenInfo != null) { repInfo.FirstName = citizenInfo.FirstName; repInfo.LastName = citizenInfo.LastName; repInfo.Address = citizenInfo.Address; repInfo.AmountPaid = rep[i].AmountPaid; repInfo.Email = rep[i].Email; repInfo.LicenseType = rep[i].LicenseType; repInfo.DateRegistered = rep[i].DateRegistered; report.Add(repInfo); } } return(View(report)); } }
public ActionResult EditCitizen(Citizen emp) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var emp1 = db.Citizens.Where(row => row.CitizenId == emp.CitizenId).FirstOrDefault(); if (emp1 == null) { return(RedirectToAction("TaxRevenue")); } emp1.CitizenId = emp.CitizenId; emp1.FirstName = emp.FirstName; emp1.LastName = emp.LastName; emp1.Address = emp.Address; emp1.Email = emp.Email; emp1.PhoneNumber = emp.PhoneNumber; emp1.LGA = emp.LGA; emp1.DateRegistered = emp.DateRegistered; emp1.Gender = emp.Gender; int res = db.SaveChanges(); if (res > 0) { ViewBag.Message = "Successfully Updated"; } } return(View()); }
public ActionResult Birth(Birth birth) { if (ModelState != null) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var result1 = db.Births.Where(a => a.Email == birth.Email).FirstOrDefault(); if (result1 == null) { ViewBag.Feedback = "Failed"; return(RedirectToAction("Birth")); } var result = db.Citizens.Single(a => a.Email == birth.Email); if (result == null) { ViewBag.Feedback = "Failed"; return(RedirectToAction("Birth")); } birth.CitizenId = result.CitizenId; db.Births.Add(birth); db.SaveChanges(); ModelState.Clear(); ViewBag.Feedback = result1.Id; } } return(View()); }
public ActionResult DeleteMarriage(int?id) { if (id == null || id == 0) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var marriage = db.Marriages.Where(row => row.Id == id).FirstOrDefault(); return(View(marriage)); } }
public ActionResult DeleteCitizen(int?id) { if (id == null || id == 0) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var citizen = db.Citizens.Where(row => row.CitizenId == id).FirstOrDefault(); return(View(citizen)); } }
public ActionResult DeleteDeath(int?id) { if (id == null || id == 0) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var death = db.Deaths.Where(row => row.Id == id).FirstOrDefault(); return(View(death)); } }
public ActionResult TaxRevenue() { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var user = db.Citizens.ToList(); if (user == null) { return(RedirectToAction("RegisterCitizen")); } ViewBag.Feedback = user.Count(); user.Reverse(); return(View(user)); } }
public ActionResult RegisteredMarriage() { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var marriageReg = db.Marriages.ToList(); if (marriageReg == null) { return(RedirectToAction("RegisterCitizen")); } ViewBag.Message = marriageReg.Count(); marriageReg.Reverse(); return(View(marriageReg)); } }
public ActionResult RegisteredDeath() { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var deathReg = db.Deaths.ToList(); if (deathReg == null) { return(RedirectToAction("RegisterCitizen")); } ViewBag.Feedback = deathReg.Count(); deathReg.Reverse(); return(View(deathReg)); } }
public ActionResult ComfirmDeleteDeath(int?id) { if (id == null || id == 0) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var deleteDeath = db.Deaths.Where(row => row.Id == id).FirstOrDefault(); db.Deaths.Remove(deleteDeath); db.SaveChanges(); return(RedirectToAction("RegisteredDeath")); } }
public ActionResult ComfirmDeleteCitizen(int?id) { if (id == null || id == 0) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var deleteCitizen = db.Citizens.Where(row => row.CitizenId == id).FirstOrDefault(); db.Citizens.Remove(deleteCitizen); db.SaveChanges(); return(RedirectToAction("TaxRevenue")); } }
public ActionResult TaxRevenue() { if (!this.AuthenticateUser()) { return(RedirectToAction("Index")); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var payment = db.Births.ToList(); if (payment == null) { return(RedirectToAction("TaxRevenue")); } payment.Reverse(); return(View(payment)); } }
public ActionResult EditProfile() { /*if (!this.AuthenticateUser()) * { * return RedirectToAction("Index"); * }*/ Citizen citizen = Session["user"] as Citizen; if (citizen == null) { return(HttpNotFound()); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var citizenInfo = db.Citizens.SingleOrDefault(row => row.CitizenId == citizen.CitizenId); return(View(citizenInfo)); } }
public ActionResult Index(Citizen user) { if (ModelState != null) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var usr = db.Citizens.SingleOrDefault(a => a.Username == user.Username && a.Password == user.Password); if (usr == null) { ViewBag.Message = "Invalid username or password"; //ModelState.AddModelError("", "Invalid Login Details!"); return(RedirectToAction("Index")); } Session["user"] = usr; } } return(RedirectToAction("Home"));; }
public ActionResult RecoverPass(Citizen citizen) { if (citizen.Password != citizen.ConfirmPassword) { return(RedirectToAction("Index")); } using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var user = db.Citizens.SingleOrDefault(c => c.Username == citizen.Username); if (user == null) { return(View()); } user.Password = citizen.Password; user.ConfirmPassword = citizen.ConfirmPassword; ViewBag.Message = "Successful"; db.SaveChanges(); } return(View()); }
public ActionResult Index(Admin user) { if (ModelState != null) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var usr = db.Admins.SingleOrDefault(a => a.Username == user.Username && a.Password == user.Password); if (usr != null) { Session["UserId"] = usr.Id.ToString(); Session["Username"] = usr.Username.ToString(); return(RedirectToAction("Home")); } else { ViewBag.Message = "Invalid Username or Passwor!"; //ModelState.AddModelError("", "Invalid Username or Passwor!"); } } } return(View()); }
public ActionResult RegisterClient(Citizen citizen) { if (ModelState != null) { using (RevenueManagementDbContext db = new RevenueManagementDbContext()) { var result = db.Citizens.Where(a => a.Email == citizen.Email).FirstOrDefault(); if (result != null) { ViewBag.Feedback = "Record Already Exist."; return(RedirectToAction("RegisterClient")); } db.SaveChanges(); db.Citizens.Add(citizen); db.SaveChanges(); ModelState.Clear(); ViewBag.Feedback = "Successfully Registered."; } } return(View()); }