public static void UpdateInactive(EmailOTP emailotp) { using (var db = DatabaseService.Connection) { Dapper.SqlMapper.SetTypeMap(typeof(EmailOTP), new ColumnAttributeTypeMapper <EmailOTP>()); db.Execute(ScriptService.Scripts["emailotp_update_inactive"], emailotp); } }
public static long Insert(EmailOTP emailotp) { using (var db = DatabaseService.Connection) { Dapper.SqlMapper.SetTypeMap(typeof(EmailOTP), new ColumnAttributeTypeMapper <EmailOTP>()); return(db.Query <long>(ScriptService.Scripts["emailotp_insert"], emailotp).Single()); } }
/** * Generates an email OTP with an attached notification for * callback. Also stores the object in the database. * * @param - the notification to be attached to the EmailOTP * @returns - the EmailOTP generated and stored in the databse */ public static EmailOTP GenerateEmailOtp(Notification n) { var otp = new EmailOTP { NotificationId = n.NotificationId, Time = DateTime.Now, Code = RandomString(64) }; otp.Id = DatabaseEmailOtpService.Insert(otp); return(otp); }