asp.net mvc - how to validate Viewmodel in multiLang in mvc -


i have viewmodel , use asp.net mvc , ef code first .

 public class addnewsvm {     public string title { get; set; }     public string titleen { get; set; }     public string body { get; set; }     public string bodyen { get; set; }     public string author { get; set; }     public bool isactive { get; set; }     public guid imageid { get; set; } } 

but user can add ennews(englisg) or fanews(persian) or both of them . don't add required them . how can validatie . example want if use enter en news title user should enter en field . use if statement in action ?

it depends on needs. if need both (client / server) validations, recommend use:

if want validate viewmodel on server side (class level validation), can write own custom validation rules using ivalidatable.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -