Exemplo n.º 1
0
        public async Task <IActionResult> SaveAsync()
        {
            EmailResourcesBll bll            = new EmailResourcesBll();
            EmailResources    emailResources = new EmailResources();

            emailResources.Email          = Request.Form["Email"].TryToString();
            emailResources.Password       = Request.Form["Password"].TryToString();
            emailResources.Port           = Request.Form["Port"].TryToString();
            emailResources.SenderServerIp = Request.Form["SenderServerIp"].TryToString();
            emailResources.UserName       = Request.Form["UserName"].TryToString();
            await bll.AddAsync(emailResources);

            return(Json(new { code = 1, msg = "OK" }));
        }
Exemplo n.º 2
0
        public async Task <bool> DelAsync(EmailResources emailResources)
        {
            bool flag = false;

            try
            {
                DataContext dataContext = new DataContext();
                dataContext.EmailResourcess.Remove(emailResources);
                await dataContext.SaveChangesAsync();

                flag = true;
            }
            catch (Exception e)
            {
                ClassLoger.Error("EmailResourcesDal.DelAsync", e);
            }
            return(flag);
        }
Exemplo n.º 3
0
        public async Task <int> AddAsync(EmailResources emailResources)
        {
            int id = 0;

            try
            {
                DataContext dataContext = new DataContext();
                var         entity      = await dataContext.EmailResourcess.AddAsync(emailResources);

                await dataContext.SaveChangesAsync();

                id = entity.Entity.Id;
            }
            catch (Exception e)
            {
                ClassLoger.Error("EmailResourcesDal.AddAsync", e);
            }
            return(id);
        }
Exemplo n.º 4
0
 public async Task <bool> DelAsync(EmailResources emailResources)
 {
     return(await EmailResourcesDal.Ins.DelAsync(emailResources));
 }
Exemplo n.º 5
0
 public async Task <int> AddAsync(EmailResources emailResources)
 {
     return(await EmailResourcesDal.Ins.AddAsync(emailResources));
 }