Created
June 18, 2011 02:50
-
-
Save mgroves/1032749 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [HttpPost] | |
| public ActionResult Edit(int id, MyNameEntity name) | |
| { | |
| if(!ModelState.IsValid) | |
| { | |
| return View(name); | |
| } | |
| return RedirectToAction("Index"); | |
| } | |
| using System.ComponentModel.DataAnnotations; | |
| namespace MyProject.Web.Models.Entities | |
| { | |
| public class MyNameEntity | |
| { | |
| public int Id { get; set; } | |
| [Required] | |
| public string Name { get; set; } | |
| [Required] | |
| public NameGroup? Group { get; set; } | |
| [Required] | |
| public string Prop1 { get; set; } | |
| public string Prop2 { get; set; } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I renamed "name" to "test" it didn't return null anymore.