ActionOutput <UserModel> IUserManager.VeifyOTP(OTPModel model) { ActionOutput <UserModel> res = new ActionOutput <UserModel>(); try { var user = Context.UserTbls.Where(p => p.Id == model.Id && p.Status == (int)UserStatuss.Registered).FirstOrDefault(); if (user != null) { if (user.OTP == model.OTP.ToString()) { if (user.RoleId == (int)UserRoleTypes.Mother) { user.Status = (int)UserStatuss.Verified; MotherTbl _mother = new MotherTbl(); _mother.ApplicationNo = UtilitiesHelp.GenerateApplicationNo(); _mother.UserId = user.Id; _mother.WalletAmount = 0; _mother.Commision = 0; _mother.Ratings = 0; Context.MotherTbls.Add(_mother); Context.SaveChanges(); res.Object = new UserModel(user); res.Status = ActionStatus.Successfull; res.Message = "Mother Verified successfully. Wait for Admin approval."; } else { user.Status = (int)UserStatuss.Approved; Context.SaveChanges(); res.Object = new UserModel(user); res.Status = ActionStatus.Successfull; res.Message = "User Verified successfully"; } } else { res.Status = ActionStatus.Error; res.Message = "Incorrect OTP."; } } else { res.Status = ActionStatus.Error; res.Message = "User doesnt exists."; } } catch (Exception ex) { res.Status = ActionStatus.Error; res.Message = "Some Errpr Occurred"; } return(res); }
public MotherListModel(MotherTbl obj) { this.Id = obj.Id; this.UserId = obj.UserId; this.ApplicationNo = obj.ApplicationNo; this.Ratings = obj.Ratings; this.Description = obj.Description; this.LOfflineTime = obj.LOfflineTime; this.DOfflineTime = obj.DOfflineTime; this.LDeliveryTime = obj.LDeliveryTime; this.DDeliveryTime = obj.DDeliveryTime; this.ProfilePhoto = obj.ProfilePhoto; this.UserId = obj.UserId; this.WalletAmount = obj.WalletAmount; }