Example #1
0
        public async Task <TempOtpViewModel> AddTempOtp(int UserId, int RegTypeId)
        {
            var currentTempotp = new TempOtpMaster
            {
                UserId       = UserId,
                RegTypeId    = RegTypeId,
                OTP          = _userService.GenerateRandomOTP().ToString(),
                CreatedTime  = DateTime.UtcNow,
                ExpirTime    = DateTime.UtcNow.AddHours(2),
                Status       = 0,
                CreatedDate  = DateTime.UtcNow,
                CreatedBy    = UserId,
                EnableStatus = false
            };

            _dbContext.Add(currentTempotp);
            _dbContext.SaveChanges();

            TempOtpViewModel model = new TempOtpViewModel();

            model.OTP          = currentTempotp.OTP;
            model.Id           = currentTempotp.Id;
            model.UserId       = currentTempotp.UserId;
            model.EnableStatus = currentTempotp.EnableStatus;
            model.ExpirTime    = currentTempotp.ExpirTime;
            model.CreatedTime  = currentTempotp.CreatedTime;
            model.RegTypeId    = currentTempotp.RegTypeId;
            return(model);
        }
Example #2
0
 public long AddCompainTrail(CompainTrailReqVirewModel compainTrail)
 {
     try
     {
         if (compainTrail == null)
         {
             return(0);
         }
         else
         {
             var compainTrailData = new CompainTrail();
             {
                 compainTrailData.ComplainId = compainTrail.ComplainId;
                 if (string.IsNullOrEmpty(compainTrail.Complainstatus))
                 {
                     compainTrailData.Complainstatus = "Open";
                 }
                 else
                 {
                     compainTrailData.Complainstatus = compainTrail.Complainstatus;
                 }
                 compainTrailData.CreatedDate = DateTime.UtcNow;
                 compainTrailData.CreatedBy   = compainTrail.UserID;
                 compainTrailData.Description = compainTrail.Description;
                 if (string.IsNullOrEmpty(compainTrail.Remark))
                 {
                     compainTrailData.Remark = " ";
                 }
                 else
                 {
                     compainTrailData.Remark = compainTrail.Remark;
                 }
             }
             _dbContext.Add(compainTrailData);
             _dbContext.SaveChanges();
             return(compainTrailData.Id);
         }
     }
     catch (Exception ex)
     {
         ex.ToString();
         throw;
     }
 }
Example #3
0
        public async Task <TempUserRegisterViewModel> AddTempRegister(TempUserRegisterViewModel model)
        {
            var currentTempReguser = new TempUserRegister
            {
                RegTypeId    = model.RegTypeId,
                Mobile       = model.Mobile,
                UserName     = model.UserName,
                FirstName    = model.FirstName,
                LastName     = model.LastName,
                PasswordHash = model.PasswordHash,
                Email        = model.Email,
                CreatedDate  = DateTime.UtcNow,
            };

            _dbContext.Add(currentTempReguser);
            _dbContext.SaveChanges();
            if (!(currentTempReguser.RegTypeId == Convert.ToInt16(Core.Enums.enRegisterType.Standerd)))
            {
                var obj = await _tempOtpService.AddTempOtp((int)currentTempReguser.Id, currentTempReguser.RegTypeId);

                TempUserRegisterViewModel temp = new TempUserRegisterViewModel();
                temp.Id             = currentTempReguser.Id;
                temp.RegTypeId      = currentTempReguser.RegTypeId;
                temp.UserName       = currentTempReguser.UserName;
                temp.Email          = currentTempReguser.Email;
                temp.RegisterStatus = currentTempReguser.RegisterStatus;

                return(temp);
            }
            else if (currentTempReguser != null)
            {
                TempUserRegisterViewModel temp = new TempUserRegisterViewModel();
                temp.Id             = currentTempReguser.Id;
                temp.RegTypeId      = currentTempReguser.RegTypeId;
                temp.UserName       = currentTempReguser.UserName;
                temp.Email          = currentTempReguser.Email;
                temp.RegisterStatus = currentTempReguser.RegisterStatus;
                return(temp);
            }
            else
            {
                return(null);
            }
        }
 public void AddRegisterType(RegisterType model)
 {
     _dbContext.Add(model);
     _dbContext.SaveChanges();
 }