I am starting my programming journey again today. Over the past few days, I have completed many practical exercises.
I enjoyed working with Angular programming the most, which is why I have changed the name of my old domain to ng-build.com. If you have been following me for a while, I want to share that you'll really enjoy working with AngularJS. Angular is a single-page application framework that involves asynchronous calls.
Angular has now been optimized to design even faster and more robust applications. It now offers lazy loading components, which allow you to render only the libraries you are using. Previously, Angular used a single module file that would load all components and libraries together, but that's no longer the case.
Now, the structure of our components has evolved as follows.
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</form>
</div>
</div>
@section scripts
{
<script type="text/javascript">
$(document).ready(function () {
var i = 1;
$("#Addbutton").click(function () {
var div = $("<div />");
var value = "";
var nameBox = $("<input />").attr("type", "textbox").attr("name", "People["+ i +"].Name");
var fatherBox = $("<input />").attr("type", "textbox").attr("name", "People[" + i + "].FatherName");
public class City
{
public int Id { get; set; }
public string Name { get; set; }
public int StateId { get; set; }
public virtual State State { get; set; }
}
public class State
{
public int Id { get; set; }
public string Title { get; set; }
public virtual List<City> City { get; set; }
}
public class TreeViewNode
{
public string id { get; set; }
public string parent { get; set; }
public string text { get; set; }
}
Controller Code
[HttpGet]
public IActionResult Index()
{
List<TreeViewNode> nodes = new List<TreeViewNode>();
//Loop and add the Parent Nodes.
foreach (State type in _context.State)
{
nodes.Add(new TreeViewNode { id = type.Id.ToString(), parent = "#", text = type.Title });
}
//Loop and add the Child Nodes.
foreach (City subType in _context.City)
{
nodes.Add(new TreeViewNode { id = subType.StateId.ToString() + "-" + subType.Id.ToString(), parent = subType.StateId.ToString(), text = subType.Name });
}
In this article, I am going to show you, How to show images in DataGridView in Windows forms c#. Its easy to bind the DataGridView with the database table which is contain binary image. You can check this code to bind the DataGridView with the image using Entity Framework.
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace BankingApplication_Tutorial
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
Step-5 Do Migration Step-6 : Create Controller
namespace WebApiTestApplication.Controllers
{
[Route("api/[controller]")]
public class StudentController : Controller
{
private Context _context;
public StudentController(Context context)
{
_context = context;
}
[HttpGet]
public List<Student> Get()
{
return _context.Students.ToList();
}
public IActionResult Index()
{
return View();
}
}}
Step- 7: Add new project Web Application in the same solution Step-8 : Add Helper Class also add View Model class
namespace WebApplication1.Helper
{
public class StudentAPI
{
public HttpClient Initial()
{
var Client = new HttpClient();
Client.BaseAddress = new Uri("http://localhost:56562/");
return Client;
}
}
}
If you Know what is "56562" then must to watch the video
And the model class
namespace WebApiTestApplication.Models
{
public class Student
{
public int Id { get; set; }
public string Name { get; set; }
}
}
Step-9 : Add A controller
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
StudentAPI _api = new StudentAPI();
public async Task<IActionResult> Index()
{
List<Student> student = new List<Student>();
HttpClient client = _api.Initial();
HttpResponseMessage res = await client.GetAsync("api/Student");
if (res.IsSuccessStatusCode)
{
var result = res.Content.ReadAsStringAsync().Result;
student = JsonConvert.DeserializeObject<List<Student>>(result);
}