예제 #1
0
        public ActionResult ApproveCustomer(int id, bool Approved)
        {
            SavingResult SavingRes = DALObj.ApproveUser(id, Approved);

            CustomerViewModel ViewModel = DALObj.FindByID(id);

            if (Common.Functions.SetAfterSaveResult(ModelState, SavingRes))
            {
                CustomerViewModel Customer = DALObj.FindByID(id);

                string SendTo  = null;
                string Subject = null;
                string Body    = null;
                if (Approved)
                {
                    SendTo  = Customer.EMailID;
                    Subject = "You account has been approved.";
                    Body    = string.Format(@"Dear sir,
Your account on {0} has been approved. Now you can place order on {0}.

Please login by clicking on the link below. 

{1}

If the above link is not working then please copy and paste the above link in address bar. If you have any issue, please contact support on {0}
", Common.Props.CurrentDomainName,
                                            Common.Props.CurrentDomainName + @"/Users/Login");

                    Common.Functions.SendEmailFromNoReply(SendTo, Subject, Body);
                }
                else
                {
                    SendTo  = Customer.EMailID;
                    Subject = "You account has been rejected by admin.";
                    Body    = string.Format(@"Dear customer,
Your account on {0} has been disapproved and rejected by admin. Please contact support on {0} for more details.", Common.Props.CurrentDomainName);

                    Common.Functions.SendEmailFromNoReply(SendTo, Subject, Body);
                }

                return(RedirectToAction("ApproveCustomerConfirm", new { id = id }));
            }

            return(View(ViewModel));
        }