Ejemplo n.º 1
0
        public async Task <ActionResult> Create(SMTPGatewayModel smtpgateway)
        {
            var Gatewaylist = await CommonModel.GetGatewayType();

            var GatewayTypeId = Gatewaylist.Where(x => x.Text == "SMTP Gateway").Select(x => x.Value).SingleOrDefault();
            var GatewayModel  = new GatewayModel
            {
                GatewayId      = smtpgateway.GatewayId,
                GatewayTypeId  = GatewayTypeId,
                GatewayName    = smtpgateway.GatewayName,
                IsActive       = smtpgateway.IsActive,
                IsDefault      = smtpgateway.IsDefault,
                IsProcessByAWS = smtpgateway.IsProcessByAWS,
                Name           = smtpgateway.Name,
                Email          = smtpgateway.Email,
                SmtpServerName = smtpgateway.SmtpServerName,
                SmtpUserName   = smtpgateway.SmtpUserName,
                SmtpPassword   = smtpgateway.SmtpPassword,
                PortNumber     = smtpgateway.PortNumber,
                SSLEnabled     = smtpgateway.SSLEnabled,
                UserId         = CurrentUser.UserId,
                CompanyId      = CurrentUser.CompanyId
            };

            if (CurrentUser.UserTypeName.ToLower() == "super admin")
            {
                GatewayModel.CompanyId = smtpgateway.CompanyId;
            }
            var response = await _gatewayRepo.AddUpdateDeleteGateway(GatewayModel, 'I');

            _gatewayRepo.Save();
            TempData["response"] = response;
            TempData.Keep("response");
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Index()


        {
            var getwaylist = await CommonModel.GetGatewayType();


            var getwayTypeId = getwaylist.Where(x => x.Text == "Notification Gateway").Select(x => x.Value).SingleOrDefault();

            var notificationgateway = await _gatewayRepo.GetGatewayByType(new Filters.FilterModel {
                GatewayTypeId = getwayTypeId, CompId = CurrentUser.CompanyId
            });

            NotificationGateWayMainModel model = new NotificationGateWayMainModel();

            model.Gateway = new NotificationGatewayModel();
            if (CurrentUser.UserTypeName.ToLower() == "super admin")
            {
                model.Gateway.IsAdmin     = true;
                model.Gateway.CompanyList = new SelectList(await CommonModel.GetCompanies(), "Name", "Text");
            }
            model.mainModel             = Mapper.Map <List <NotificationGatewayModel> >(notificationgateway);
            model.Gateway.GatewayTypeId = getwayTypeId;
            model.Gateway.GatewayList   = new SelectList(notificationgateway, "GatewayId", "GatewayName");

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Index()
        {
            //   var smtpgateway = new SMTPGatewayList();
            var Gatewaylist = await CommonModel.GetGatewayType();

            var GatewayTypeId = Gatewaylist.Where(x => x.Text == "SMTP Gateway").Select(x => x.Value).SingleOrDefault();
            var GatewayModel  = await _gatewayRepo.GetGatewayByType(new Filters.FilterModel {
                GatewayTypeId = GatewayTypeId, CompId = CurrentUser.CompanyId
            });

            SMTPGateWayMainModel model = new SMTPGateWayMainModel();

            model.Gateway = new SMTPGatewayModel();

            model.Gateway.GatewayTypeId = GatewayTypeId;
            model.Gateway.GatewayList   = new SelectList(GatewayModel, "GatewayId", "GatewayName");
            model.mainModel             = Mapper.Map <List <SMTPGatewayModel> >(GatewayModel);
            return(View(model));
        }