I am looking to enter a random date for a given class in a note when passing a note of a block of text. How does one input and add a random date for a given note text?
using CY.Data.Interface;
using CY.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CY.Data.Ado
{
public class NoteRepository : INoteRepository
{
.....
public static void RandomDate()
{
// 1. Adding the Start Date for the number of time that it is going to start.
// 2. Adding the End Date for the time it is going to end.
// 3. Adding the range of the time for the total number of days.
// 4. Add a int randDays where one converts the rnd.Next to in a Int32 numRange format.
// 5. Print a Random Random on a console writeline input.
DateTime startDate = DateTime.Now.AddYears(-1);
DateTime endDate = DateTime.Now;
double numRange = (endDate - startDate).TotalDays;
int randDays = rnd.Next(Convert.ToInt32(numRange));
DateTime randDate = startDate.AddDays(randDays);
Console.WriteLine(randDate.ToString());
}
}
}
The end result should be utilizing a random Date and running it on the browser. How does use ADO.NET to integrate printing a random date on a given note?
References:
1) Microsoft Documentation on ADO.NET:
https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/ado-net-overview
2) Microsoft Documentation on Using Data sets from ADO.NET to print data: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/ado-net-datasets