1
나는 asf.net mvc 프로젝트를 사용했다. 의 "추가"컨트롤러 =>MVC에서 엔터티 프레임 워크 유효성 검사
[Authorize(Roles = "Admin")]
public ActionResult Add()
{
using (Process _process = new Process())
ViewBag.KlinikListesi = _process.KlinikleriGetir();
return View();
}
[Authorize(Roles = "Admin")]
[HttpPost]
public ActionResult Add(uzmanlik_egitim _ueModel)
{
using (Process _process = new Process())
{
ViewBag.KlinikListesi = _process.KlinikleriGetir();
if (Request.QueryString["userName"] != null)
{
_ueModel.kullanici_adi = Request.QueryString["userName"].ToString();
_process.Add(_ueModel);
}
}
return View();
}
그리고 내가 그것을 완벽하게 작동보기 (EF 테이블로 선택된 모델 (uzmanlik_egitim))를
만들었습니다.
는하지만 필드의 유효성을 검사 할 필요가 난 =>
//[MetadataType(typeof(uzmanlik_egitim_metadata))]
//public partial class uzmanlik_egitim
//{
//}
//public class uzmanlik_egitim_metadata
//{
// [Required]
// public string kullanici_adi { get; set; }
// [Required]
// public int ID { get; set; }
// [Required]
// public string klinik { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? ulusal_kongre { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? uluslararasi_kongre { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? yurtici_sunum { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? yurtdisi_sunum { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? yurtici_bilimsel_yayin { get; set; }
// [StringLength(1, ErrorMessage = "En Fazla 1 Karakter")]
// public int? yurtdisi_bilimsel_yayin { get; set; }
//}
을 시도했지만 유형 의 내가 stucked이기 때문에 나는 오류를 받고 있어요.