Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
        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());
        }
Ejemplo n.º 6
0
        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"));
            }
        }
Ejemplo n.º 7
0
        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"));
            }
        }
Ejemplo n.º 8
0
        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());
        }