public ActionResult Trash(int?page, string keyword)
        {
            EmailListVM emailListVM = GetElements(page, keyword, false);

            ViewBag.PageSizes = new SelectList(Site.PageSizes());
            return(View(emailListVM));
        }
 public async Task <JsonResult> ELGet(string id)
 {
     try {
         var data = EmailListService.GetByID(Guid.Parse(Request.Form["id"]));
         return(Success(EmailListVM.MToVM(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> ELGetAll()
 {
     try {
         var data = EmailListService.GetAll();
         return(Success(EmailListVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
Beispiel #4
0
 public static bool Insert(Guid id, string name, string email, Guid dtid, string cnum)
 {
     try {
         var data = EmailListVM.set(id, name, email, dtid, cnum);
         using (var context = new CentralProcessContext()){
             context.EmailListDB.Add(data);
             context.SaveChanges();
             return(true);
         }
     } catch { return(false); }
 }
        private EmailListVM GetElements(int?page, string keyword, bool active)
        {
            var emailListVM = new EmailListVM();

            emailListVM.Keyword   = keyword;
            emailListVM.PageIndex = (page ?? 1);
            emailListVM.PageSize  = SettingsManager.Email.PageSize;
            int totalCount;
            var emaillist = _emailServices.GetPagedElements(emailListVM.PageIndex - 1, emailListVM.PageSize, emailListVM.Keyword, active, out totalCount);

            // var emailVMList = _mapper.Map<List<Email>, List<EmailVM>>(emaillist);
            emailListVM.TotalCount = totalCount;
            emailListVM.Emails     = new StaticPagedList <Email>(emaillist, emailListVM.PageIndex, emailListVM.PageSize, emailListVM.TotalCount);;
            return(emailListVM);
        }