コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ApprovedOwnerss approvedOwners = db.ApprovedOwners.Find(id);

            db.ApprovedOwners.Remove(approvedOwners);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ownerID,FullName,LastName,IDNumber,Type,Status,Email,Phone,Nationality,Gender,AltContactNumber")] ApprovedOwnerss approvedOwners)
 {
     if (ModelState.IsValid)
     {
         db.Entry(approvedOwners).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(approvedOwners));
 }
コード例 #3
0
        public ActionResult Approve(int?id)
        {
            ApprovedOwnerss approvedOwners = db.ApprovedOwners.Where(p => p.ownerID == id).FirstOrDefault();

            approvedOwners.Status          = "Paid";
            db.Entry(approvedOwners).State = EntityState.Modified;
            db.SaveChanges();
            TempData["AlertMessage"] = $"Status successfully updated";

            return(RedirectToAction("Index1"));
        }
コード例 #4
0
        public ActionResult Approve(int?id)
        {
            Owner owner = db.owners.Where(p => p.ownerID == id).FirstOrDefault();

            if (owner.Status == "Approved" || owner.Status == "Rejected")
            {
                TempData["AlertMessage"] = "Th application has already been Rejected/Approved";
                return(RedirectToAction("AdminIndex"));
            }
            else
            {
                ApprovedOwnerss approvedOwnerss = new ApprovedOwnerss();
                approvedOwnerss.ownerID          = owner.ownerID;
                approvedOwnerss.FullName         = owner.FullName;
                approvedOwnerss.LastName         = owner.LastName;
                approvedOwnerss.Email            = owner.Email;
                approvedOwnerss.IDNumber         = owner.IDNumber;
                approvedOwnerss.Phone            = owner.Phone;
                approvedOwnerss.Type             = owner.Type;
                approvedOwnerss.FileName         = owner.FileName;
                approvedOwnerss.AltContactNumber = owner.AltContactNumber;
                approvedOwnerss.Status           = "Approved";
                db.ApprovedOwners.Add(approvedOwnerss);
                db.SaveChanges();
                //var userId = User.;
                //var nno = db.owners.ToList().Where(p => p.Email == approvedOwnerss.Email).Select(p => p.FullName).FirstOrDefault();
                //var user = db.owners.Find(owner.UserId);

                var mailTo = new List <MailAddress>();
                mailTo.Add(new MailAddress(owner.Email, owner.FullName));
                var body = $"Hello {owner.FullName}, Congratulations. We are glad to inform you that your application has been approved. You can now procced to adding your building details. You are required to pay the Subscription Fee in order for your building to be active to the Tenants <br/> Regards,<br/><br/> HomeLink <br/> .";

                Accommodation.Services.Implementation.EmailService emailService = new Accommodation.Services.Implementation.EmailService();
                emailService.SendEmail(new EmailContent()
                {
                    mailTo          = mailTo,
                    mailCc          = new List <MailAddress>(),
                    mailSubject     = "Application Statement | Ref No.:" + owner.ownerID,
                    mailBody        = body,
                    mailFooter      = "<br/> Many Thanks, <br/> <b>Alliance</b>",
                    mailPriority    = MailPriority.High,
                    mailAttachments = new List <Attachment>()
                });
                db.owners.Remove(owner);
                db.SaveChanges();
                //UserManager.AddToRole(user.Id, "Landlord");
                _userManager.AddToRole(owner.UserId, "Landlord");
                TempData["AlertMessage"] = $"{owner.FullName} has been successfully approved";

                return(RedirectToAction("AdminIndex"));
            }
        }
コード例 #5
0
        // GET: ApprovedOwners/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApprovedOwnerss approvedOwners = db.ApprovedOwners.Find(id);

            if (approvedOwners == null)
            {
                return(HttpNotFound());
            }
            return(View(approvedOwners));
        }