public ActionResult Add() { DiagnosisAdd objFrm = new DiagnosisAdd(); try { var symptomTypes = diagnosisRepository.GetSymptomType(); var employeeLists = employeeRepository.Get(); var strValue = "1990-01-01"; DateTime objDate; DateTime.TryParse(strValue, out objDate); objFrm.ExpiredDate = objDate; diagnosisModel = new DiagnosisModels { diagnosisAdd = objFrm, symptomTypes = symptomTypes, EmployeeLists = employeeLists, checkPost = false, checkError = false }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError(string.Empty, Translator.UnexpectedError); } return(View(diagnosisModel)); }