c# - How to use a specific value from database in mvc validations -
i have value e.g. "not interested" in database. need put validation on 1 of entity using specific value "note interested"
public class {callnote} { public datetime callback {get; set;} }
i trying in way getting error of object referance.
public class futuredateattribute : validationattribute { public override bool isvalid(object value) { string feed = "not interested" mydbcontext db = new mydbcontext(); var temp = db.savedfeedback.feedback.feedbackdropdown.except(feed).any(); if(temp.tostring() == null) { return value != null && (datetime)value > datetime.now } else return value == null } }
what right linq query , condition in case? newbie
after line var temp = db.savedfeedback.feedback.feedbackdropdown.except(feed).any(); if want check value of temp, should check bool like
if(temp) { // true //do logic } else { //this false //do logic }
Comments
Post a Comment