I have figured it out myself and thank you for the down votes
public class SerialNumber
{
private static readonly MyDbContext DbContext = new MyDbContext();
public static string SrNo()
{
var sn = DbContext.PrimaryForms.ToList().Last().FormDescription;
var array = sn.Split("https://stackoverflow.com/");
if (int.Parse(array[0]) == DateTime.Today.Year)
{
return array[0] + "https://stackoverflow.com/" + (int.Parse(array[1]) + 1);
}
return (int.Parse(array[0]) + 1) + "/1";
}
}
if code is not clear, ask me for explanation, thank you.
solved How to make an auto increment number based on a year