public ActionResult activeAccount(int id) { ActiveAccountModel activeAccountModel = new ActiveAccountModel(); activeAccountModel.CustomerID = id; return(PartialView(activeAccountModel)); }
public int activeAccount(ActiveAccountModel activeAccountModel) { try { if (ModelState.IsValid) { if (Membership.ValidateUser(User.Identity.Name, activeAccountModel.Password)) { if (activeAccountModel.CustomerID > 0) { Customer customer = customerService.GetByPrimaryKey(activeAccountModel.CustomerID); customer.CustomerState = (int)Common.Active; if (customerService.Update(customer)) { string customerName = customer.CustomerFirstName + " " + customer.CustomerLastName; LogService.WriteLog2DB(accountService.GetUserId(User.Identity.GetUserName()), (int)Common.ActionID.Update, customer.CustomerID, SDateTime.GetYYYYMMddHmmSSNow(), General.GetIPAddress(), TableNameID, customerName); if (activeAccountModel.SendEmail2Customer) { string title = "Kích hoạt tài khoản"; string body = string.Format("Tài khoản của Anh/chị {0} vừa được kích hoạt.", customer.CustomerFirstName + " " + customer.CustomerLastName); AppUser appUser = accountService.GetByPrimaryKey(accountService.GetUserId(User.Identity.GetUserName())); if (appUser != null) { General.SendEmail(appUser.Email, title, body); } } return(1); } } } } } catch (Exception ex) { LogService.WriteException(ex); } return(0); }