<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kayavathanan Thevapalan  on Medium]]></title>
        <description><![CDATA[Stories by Kayavathanan Thevapalan  on Medium]]></description>
        <link>https://medium.com/@ntkayavathanan2699?source=rss-0831fa874576------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DBJVINfK8J1XUrqtSPz7WQ.jpeg</url>
            <title>Stories by Kayavathanan Thevapalan  on Medium</title>
            <link>https://medium.com/@ntkayavathanan2699?source=rss-0831fa874576------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:59:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ntkayavathanan2699/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a User Management System: A Beginner’s Guide to .NET Console Applications]]></title>
            <link>https://medium.com/@ntkayavathanan2699/building-a-user-management-system-a-beginners-guide-to-net-console-applications-f90a20f24ea7?source=rss-0831fa874576------2</link>
            <guid isPermaLink="false">https://medium.com/p/f90a20f24ea7</guid>
            <dc:creator><![CDATA[Kayavathanan Thevapalan ]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 07:20:22 GMT</pubDate>
            <atom:updated>2025-02-11T07:20:22.482Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a User Management System: A Beginner’s Guide to .NET Console Applications</h3><p>This post will walk readers through the creation of a fully functional console-based User Management System using .NET. We’ll explore how to set up the project, implement CRUD operations, and structure clean, maintainable code with simple user interactions. It will also cover practical techniques for input validation and demonstrate the power of .NET for backend applications.</p><p><strong>Task : Create a Console Application in .net for a Management System which includes basic crud operation</strong></p><p>· <strong>ADD</strong> User</p><p>· <strong>VIEW</strong> User</p><p>· <strong>VIEW</strong> <strong>All</strong> Users</p><p>· <strong>UPDATE</strong> User</p><p>· <strong>DELETE</strong> User</p><p><strong>Here First I describe How to Setup &amp; Create a Project</strong></p><ol><li>Open a terminal or command prompt.</li><li>Navigate to the folder where you want to create the project.</li><li>Run the following command to create a new console application:</li></ol><p><strong>dotnet new console -n UserDetailsApp</strong></p><p>This command creates a new console application in a folder named <strong>UserDetailsApp</strong>.</p><ol><li>Navigate into the newly created project folder:</li></ol><p><strong>cd UserDetailsApp</strong></p><p>5. Open the project in your preferred editor (e.g., Visual Studio Code):</p><p>code .</p><ol><li>Create a User class (User.cs)</li><li>Then Add Program.cs file.</li></ol><p><strong>Code For Console Application</strong></p><p><strong>using System;</strong></p><p><strong>using System.Collections.Generic;</strong></p><p><strong>using System.Text.RegularExpressions;</strong></p><p><strong>namespace UserDetailsApp</strong></p><p><strong>{</strong></p><p><strong>class Program</strong></p><p><strong>{</strong></p><p><strong>// List to store user details</strong></p><p><strong>static List&lt;User&gt; users = new List&lt;User&gt;();</strong></p><p><strong>static void Main(string[] args)</strong></p><p><strong>{</strong></p><p><strong>// Welcome message</strong></p><p><strong>Console.WriteLine(“Welcome to the UnicornConnectedApps Management Portal!”);</strong></p><p><strong>Console.WriteLine(“ — — — — — — — — — — — — — — — — — — — — “);</strong></p><p><strong>Console.WriteLine(“What would you prefer to do”);</strong></p><p><strong>// Ask Users Function</strong></p><p><strong>while (true)</strong></p><p><strong>{</strong></p><p><strong>// Display menu</strong></p><p><strong>Console.WriteLine(“\nMenu:”);</strong></p><p><strong>Console.WriteLine(“1. Add a User”);</strong></p><p><strong>Console.WriteLine(“2. View User Details”);</strong></p><p><strong>Console.WriteLine(“3. View All Users”);</strong></p><p><strong>Console.WriteLine(“4. Delete a User”);</strong></p><p><strong>Console.WriteLine(“5. Update a User”);</strong></p><p><strong>Console.WriteLine(“6. Exit”);</strong></p><p><strong>Console.Write(“Enter your choice (1–6): “);</strong></p><p><strong>// Read user’s choice</strong></p><p><strong>int choice;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out choice) || choice &lt; 1 || choice &gt; 6)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a number between 1 and 6.”);</strong></p><p><strong>Console.Write(“Enter your choice (1–6): “);</strong></p><p><strong>}</strong></p><p><strong>// Perform action based on user’s choice</strong></p><p><strong>switch (choice)</strong></p><p><strong>{</strong></p><p><strong>case 1:</strong></p><p><strong>AddUser();</strong></p><p><strong>break;</strong></p><p><strong>case 2:</strong></p><p><strong>ViewUserDetails();</strong></p><p><strong>break;</strong></p><p><strong>case 3:</strong></p><p><strong>ViewAllUsers();</strong></p><p><strong>break;</strong></p><p><strong>case 4:</strong></p><p><strong>DeleteUser();</strong></p><p><strong>break;</strong></p><p><strong>case 5:</strong></p><p><strong>UpdateUser();</strong></p><p><strong>break;</strong></p><p><strong>case 6:</strong></p><p><strong>Console.WriteLine(“\nThank you for using the UCA Management Portal. Come again!”);</strong></p><p><strong>return; // Exit the program</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>// Method to add a user</strong></p><p><strong>static void AddUser()</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“\nAdd a New User”);</strong></p><p><strong>Console.WriteLine(“ — — — — — — — — “);</strong></p><p><strong>Console.Write(“Enter ID: “);</strong></p><p><strong>int id;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out id))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid numeric ID: “);</strong></p><p><strong>}</strong></p><p><strong>Console.Write(“Enter Name: “);</strong></p><p><strong>string name = Console.ReadLine();</strong></p><p><strong>Console.Write(“Enter Age: “);</strong></p><p><strong>int age;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out age) || age &lt;= 0)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid age (must be a positive number): “);</strong></p><p><strong>}</strong></p><p><strong>Console.Write(“Enter Email: “);</strong></p><p><strong>string email = Console.ReadLine();</strong></p><p><strong>while (!IsValidEmail(email))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid email format. Please enter a valid email: “);</strong></p><p><strong>email = Console.ReadLine();</strong></p><p><strong>}</strong></p><p><strong>// Add user to the list</strong></p><p><strong>users.Add(new User { Id = id, Name = name, Age = age, Email = email });</strong></p><p><strong>Console.WriteLine(“\nUser added successfully!”);</strong></p><p><strong>}</strong></p><p><strong>// Utility method to validate email</strong></p><p><strong>static bool IsValidEmail(string email)</strong></p><p><strong>{</strong></p><p><strong>return Regex.IsMatch(email, @”^[^@\s]+@[^@\s]+\.[^@\s]+$”);</strong></p><p><strong>}</strong></p><p><strong>// Method to view user details</strong></p><p><strong>static void ViewUserDetails()</strong></p><p><strong>{</strong></p><p><strong>Console.Write(“\nEnter User Id to search: “);</strong></p><p><strong>int id;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out id))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid numeric User ID: “);</strong></p><p><strong>}</strong></p><p><strong>var user = users.Find(u =&gt; u.Id == id);</strong></p><p><strong>if (user != null)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine($”ID: {user.Id}, Name: {user.Name}, Age: {user.Age}, Email: {user.Email}”);</strong></p><p><strong>}</strong></p><p><strong>else</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“User not found.”);</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>// Method to view all users</strong></p><p><strong>static void ViewAllUsers()</strong></p><p><strong>{</strong></p><p><strong>if (users.Count == 0)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“\nNo users available.”);</strong></p><p><strong>return;</strong></p><p><strong>}</strong></p><p><strong>Console.WriteLine(“\nAll Users:”);</strong></p><p><strong>foreach (var user in users)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine($”ID: {user.Id}, Name: {user.Name}, Age: {user.Age}, Email: {user.Email}”);</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>// Method to delete a user</strong></p><p><strong>static void DeleteUser()</strong></p><p><strong>{</strong></p><p><strong>Console.Write(“\nEnter User ID to delete: “);</strong></p><p><strong>int id;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out id))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid numeric User ID: “);</strong></p><p><strong>}</strong></p><p><strong>var user = users.Find(u =&gt; u.Id == id);</strong></p><p><strong>if (user != null)</strong></p><p><strong>{</strong></p><p><strong>users.Remove(user);</strong></p><p><strong>Console.WriteLine(“User deleted successfully.”);</strong></p><p><strong>}</strong></p><p><strong>else</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“User not found.”);</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>// Method to update a user</strong></p><p><strong>static void UpdateUser()</strong></p><p><strong>{</strong></p><p><strong>Console.Write(“\nEnter User ID to update: “);</strong></p><p><strong>int id;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out id))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid numeric User ID: “);</strong></p><p><strong>}</strong></p><p><strong>var user = users.Find(u =&gt; u.Id == id);</strong></p><p><strong>if (user != null)</strong></p><p><strong>{</strong></p><p><strong>Console.Write(“Enter new Name: “);</strong></p><p><strong>string name = Console.ReadLine();</strong></p><p><strong>Console.Write(“Enter new Age: “);</strong></p><p><strong>int age;</strong></p><p><strong>while (!int.TryParse(Console.ReadLine(), out age) || age &lt;= 0)</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid input. Please enter a valid age (must be a positive number): “);</strong></p><p><strong>}</strong></p><p><strong>Console.Write(“Enter new Email: “);</strong></p><p><strong>string email = Console.ReadLine();</strong></p><p><strong>while (!IsValidEmail(email))</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“Invalid email format. Please enter a valid email: “);</strong></p><p><strong>email = Console.ReadLine();</strong></p><p><strong>}</strong></p><p><strong>user.Name = name;</strong></p><p><strong>user.Age = age;</strong></p><p><strong>user.Email = email;</strong></p><p><strong>Console.WriteLine(“User updated successfully.”);</strong></p><p><strong>}</strong></p><p><strong>else</strong></p><p><strong>{</strong></p><p><strong>Console.WriteLine(“User not found.”);</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><p><strong>}</strong></p><h3><strong>Terminal View</strong></h3><ol><li>Open Window</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*kCQJ2H2viacvMr-BXN0PwA.png" /></figure><p>2.Add User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Gzna8GKfbGYIaNNI_boPLw.png" /></figure><p>3.View User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*q1n3kxOXi-DOYMkjlSsvYQ.png" /></figure><p>4. Add Another User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*N7uOUWZPKK-K--tigx_ABg.png" /></figure><p>5.View All Users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rzrMGcrMFi5ZoQJM2uzF1g.png" /></figure><p>6. Update User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZieM1B7mhIjcSt6GWoL_XA.png" /></figure><p>7.View Updated Details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*d4n4dZqwxEj6VxQoREoSQQ.png" /></figure><p>8.Delete a User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*UJZEFpZHac0E8_JOm4OP7g.png" /></figure><p>9. View All Users again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7QPJRbwcW88C5FUfy32wXQ.png" /></figure><p>10.Exit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Wq8Ragr8OLeKA-N6IzY-eA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f90a20f24ea7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>