public string ResetPassword(string email) { JObject status = new JObject(); using NpgsqlConnection connection = PostgreSQLCommon.OpenConnection(); const string query = @"SELECT email FROM public.user WHERE email = @email"; List <string> emails = connection.Query <string>(query, new { email }).ToList(); if (emails.Count == 0) { status.Add(new JProperty("status", 0)); status.Add(new JProperty("msg", "email is not existed")); return(status.ToString()); } User user = new User { password = Common.MD5String("abc123"), email = email, update_at = DateTime.Now }; const string sql = @"UPDATE public.user SET password = @password, update_at = @update_at WHERE email = @email"; connection.Execute(sql, user); status.Add(new JProperty("status", 1)); return(status.ToString()); }