MVC company assignments
C#
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
public string Email { get; set; }
public long PhoneNumber { get; set; }
}
[HttpGet]
public ActionResult AddPerson()
{
return View();
}
[HttpPost]
public ActionResult AddPerson(Person person)
{
mDataContext.Persons.Add(person);
mDataContext.SaveChanges();
return RedirectToAction("Index");
}
public class Person
{
[Key]
[Required]
public int PersonId { get; set; }
[Required]
[Display(Name = "First Name")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Last Name")]
public string LastName { get; set; }
[Required]
public string Address { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[Display(Name = "Phone Number")]
public long PhoneNumber { get; set; }
}
[HttpPost]
public ActionResult AddPerson(Person person)
{
if (ModelState.IsValid)
{
mDataContext.Persons.Add(person);
mDataContext.SaveChanges();
RedirectToAction("Index");
}
return View();
}
Also in C#:
- Title
- sort datatable c#
- Category
- C#
- Title
- C# .net core convert to int round up
- Category
- C#
- Title
- unity invoke
- Category
- C#
- Title
- make camera follow character unity 2020
- Category
- C#
- Title
- array copy c#
- Category
- C#
- Title
- create dropdown in datatable c# dynamically
- Category
- C#
- Title
- how to raycast unit
- Category
- C#
- Title
- how to record number of times using application in c#
- Category
- C#
- Title
- create new object from generic c#
- Category
- C#
- Title
- mvc input type file
- Category
- C#
- Title
- c# timespan
- Category
- C#
- Title
- c# get directory part of path
- Category
- C#
- Title
- c# switch statement
- Category
- C#
- Title
- c sharp exit while loop
- Category
- C#
- Title
- unity remove gameobject
- Category
- C#
- Title
- c# getasync response
- Category
- C#
- Title
- unity load scene
- Category
- C#
- Title
- public enum c#
- Category
- C#
- Title
- c sharp index of substring
- Category
- C#
- Title
- asp multi select dropdown
- Category
- C#
- Title
- bind repeater to dictionary
- Category
- C#
- Title
- unity rotate object relative to camera
- Category
- C#
- Title
- html hidden text
- Category
- C#
- Title
- call a function c#
- Category
- C#
- Title
- eventos c#
- Category
- C#
- Title
- convert from xls to xlsx C#
- Category
- C#
- Title
- get permission to write read file and directory on file system C#
- Category
- C#
- Title
- how to declare variables in c#
- Category
- C#
- Title
- iterate through dictionary c#
- Category
- C#
- Title
- how to make error sound c#
- Category
- C#
- Title
- C# save pdf stream to file
- Category
- C#
- Title
- unity how to set an objects postion x,y,z
- Category
- C#
- Title
- C# how to get public key for InternalsVisibleTo
- Category
- C#
- Title
- unity rotate around axis
- Category
- C#
- Title
- c# move with arrow keys
- Category
- C#
- Title
- c# authorize attribute
- Category
- C#
- Title
- unity ai wander script
- Category
- C#
- Title
- get web config key value in c# razor view
- Category
- C#
- Title
- unity find object by name
- Category
- C#
- Title
- unity custom editor save changes
- Category
- C#
- Title
- check if string is email c#
- Category
- C#
- Title
- c# polymorphism
- Category
- C#
- Title
- write string multiple times c#
- Category
- C#
- Title
- snippet to create constructor in asp.net c#
- Category
- C#
- Title
- set int to null c#
- Category
- C#
- Title
- exception handling c# stack overflow
- Category
- C#
- Title
- zip file ignoring directory starting with dot
- Category
- C#
- Title
- how to update a project to cross target .net core
- Category
- C#
- Title
- c# keyvaluepair
- Category
- C#
- Title
- unity get velocity at point
- Category
- C#
- Title
- Update data in db .net
- Category
- C#
- Title
- c# arrays of arrays
- Category
- C#
- Title
- usermanager change password without current password
- Category
- C#
- Title
- how to detected WindowCloseEvent in other window wpf
- Category
- C#
- Title
- c# bool list count true
- Category
- C#
- Title
- what type of variable is true or false in c#
- Category
- C#
- Title
- add row and columns to grid wpf in code
- Category
- C#
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- convert number of days into months c#
- Category
- C#
- Title
- while loop check condition c#
- Category
- C#
- Title
- how to add object in dictionary in c#
- Category
- C#
- Title
- visual studio C# hintergrund bild ändern
- Category
- C#
- Title
- Check object is in layermask unity
- Category
- C#
- Title
- unity up arrow input
- Category
- C#
- Title
- c# ramdom
- Category
- C#
- Title
- create asp.net which send email and sms using own api
- Category
- C#
- Title
- attribute usage c#
- Category
- C#
- Title
- c# query string builder
- Category
- C#
- Title
- unity 2d Drag object
- Category
- C#
- Title
- unity 2d detect click on sprite
- Category
- C#
- Title
- c# remove time in datetime
- Category
- C#
- Title
- c# webrequest cookies
- Category
- C#
- Title
- how to make infinite loop in c#
- Category
- C#
- Title
- unity detect any key
- Category
- C#
- Title
- csharp first element of array
- Category
- C#
- Title
- isdaylightsavingtime in c#
- Category
- C#
- Title
- null coalescing operator c#
- Category
- C#
- Title
- c# string array to string
- Category
- C#
- Title
- c# region tag
- Category
- C#
- Title
- c# index in select
- Category
- C#
- Title
- c# replace string case insensitive
- Category
- C#
- Title
- asp.net core timeout
- Category
- C#
- Title
- c# integer to bit string
- Category
- C#
- Title
- csharp check if env is development
- Category
- C#
- Title
- for each property in object c#
- Category
- C#
- Title
- split string in c#
- Category
- C#
- Title
- what does gameobject.find return
- Category
- C#
- Title
- c# foreach arra
- Category
- C#
- Title
- unity getcomponent
- Category
- C#
- Title
- windows form rounded corners
- Category
- C#
- Title
- unity get data from firebase
- Category
- C#
- Title
- loop over enum values
- Category
- C#
- Title
- how to close a windows form application in c#
- Category
- C#
- Title
- c# param exception
- Category
- C#
- Title
- c# download string url
- Category
- C#
- Title
- c# remove last value from list
- Category
- C#
- Title
- linq c# or
- Category
- C#
- Title
- c# how to run external program with args
- Category
- C#
- Title
- .net 4.5 use tls 1.2
- Category
- C#
- Title
- how to check if textbox is empty in c#
- Category
- C#