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> Create(NotificationGatewayModel notificationgateway)
 {
     if (ModelState.IsValid)
     {
         var gatewayModel = new GatewayModel
         {
             GatewayId         = notificationgateway.GatewayId,
             GatewayTypeId     = notificationgateway.GatewayTypeId,
             GatewayName       = notificationgateway.GatewayName,
             IsActive          = notificationgateway.IsActive,
             SenderID          = notificationgateway.SenderID,
             GoogleApikey      = notificationgateway.GoogleApikey,
             GoogleApiURL      = notificationgateway.GoogleApiUrl,
             GoogleProjectID   = notificationgateway.GoogleProjectID,
             GoogleProjectName = notificationgateway.GoogleProjectName,
             UserId            = CurrentUser.UserId,
             CompanyId         = CurrentUser.CompanyId,
         };
         if (CurrentUser.UserTypeName.ToLower() == "super admin")
         {
             gatewayModel.CompanyId = notificationgateway.CompanyId;
         }
         ResponseModel response = new ResponseModel();
         if (gatewayModel.GatewayId != 0)
         {
             response = await _gatewayRepo.AddUpdateDeleteGateway(gatewayModel, 'U');
         }
         else
         {
             response = await _gatewayRepo.AddUpdateDeleteGateway(gatewayModel, 'I');
         }
         _gatewayRepo.Save();
         TempData["response"] = response;
         TempData.Keep("response");
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(notificationgateway));
     }
 }
 public async Task <ActionResult> Create(SMSGatewayModel smsgateway)
 {
     if (ModelState.IsValid)
     {
         var gatewayModel = new GatewayModel {
             GatewayId      = smsgateway.GatewayId,
             GatewayTypeId  = smsgateway.GatewayTypeId,
             GatewayName    = smsgateway.GatewayName,
             IsActive       = smsgateway.IsActive,
             OTPApikey      = smsgateway.OTPApikey,
             TransApikey    = smsgateway.TransApikey,
             URL            = smsgateway.URL,
             OTPSender      = smsgateway.OTPSender,
             SuccessMessage = smsgateway.SuccessMessage,
             UserId         = CurrentUser.UserId,
             CompanyId      = CurrentUser.CompanyId
         };
         if (CurrentUser.UserTypeName.ToLower() == "super admin")
         {
             gatewayModel.CompanyId = smsgateway.CompanyId;
         }
         ResponseModel response = new ResponseModel();
         if (gatewayModel.GatewayId != 0)
         {
             response = await _gatewayRepo.AddUpdateDeleteGateway(gatewayModel, 'U');
         }
         else
         {
             response = await _gatewayRepo.AddUpdateDeleteGateway(gatewayModel, 'I');
         }
         _gatewayRepo.Save();
         TempData["response"] = response;
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(smsgateway));
     }
 }