public ActionResult AddAccount(AccountModel model) { DataAccess.Tnsmtp_Account tnsmtp_Account = new DataAccess.Tnsmtp_Account(); tnsmtp_Account.Account = model.Account; tnsmtp_Account.Password = model.Password; DataAccess.Tnsmtp_AccountCollection tnsmtp_AccountCollection = new DataAccess.Tnsmtp_AccountCollection(); tnsmtp_AccountCollection.ListByUserId(SysUser.UserId); if (tnsmtp_AccountCollection.DataTable.Rows.Count > 0) { tnsmtp_Account.Isdefault = 0; } else { tnsmtp_Account.Isdefault = 1; } tnsmtp_Account.MailType = model.Mail_Type; tnsmtp_Account.Status = 0; tnsmtp_Account.Userid = SysUser.UserId; if (!tnsmtp_Account.Insert()) { return(FailResult("添加失败!")); } return(SuccessResult("添加成功!")); }
public ActionResult ListAccount() { DataAccess.Tnsmtp_AccountCollection tnsmtp_AccountCollection = new DataAccess.Tnsmtp_AccountCollection(); if (!tnsmtp_AccountCollection.ListByUserId(SysUser.UserId)) { return(FailResult("获取账户失败!")); } var list = MapProvider.Map <AccountListModel>(tnsmtp_AccountCollection.DataTable); return(SuccessResultList(list, tnsmtp_AccountCollection.ChangePage)); }