added survey start and end date validation
This commit is contained in:
parent
ff3847ecae
commit
70d0043e25
@ -178,6 +178,11 @@ namespace DamageAssesment.Api.Surveys.Providers
|
||||
{
|
||||
if (survey != null)
|
||||
{
|
||||
if (survey.StartDate != null && survey.EndDate != null)
|
||||
{
|
||||
if(survey.StartDate.Value>survey.EndDate.Value)
|
||||
return (false, null, $"Survey start date should be less than enddate");
|
||||
}
|
||||
survey.CreatedDate = DateTime.Now;
|
||||
Db.Survey _survey = mapper.Map<Models.Survey, Db.Survey>(survey);
|
||||
|
||||
@ -214,6 +219,11 @@ namespace DamageAssesment.Api.Surveys.Providers
|
||||
{
|
||||
if (survey != null)
|
||||
{
|
||||
if (survey.StartDate != null && survey.EndDate != null)
|
||||
{
|
||||
if (survey.StartDate.Value > survey.EndDate.Value)
|
||||
return (false, null, $"Survey start date should be less than enddate");
|
||||
}
|
||||
var _survey = await surveyDbContext.Surveys.AsNoTracking().Where(s => s.Id == Id).SingleOrDefaultAsync();
|
||||
|
||||
if (_survey != null)
|
||||
|
Loading…
Reference in New Issue
Block a user