Fix equipment creation blocked by maintenance interval validation
RecommendedMaintenanceIntervalDays was a non-nullable int with [Range(1,3650)], so submitting the form without filling it in bound to 0 and failed validation. Made nullable on the entity, both DTOs, and the one controller callsite that calls .AddDays() (now uses .Value). Migration applied. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -580,7 +580,7 @@ public class MaintenanceController : Controller
|
||||
// Calculate next scheduled maintenance
|
||||
if (equipment.RecommendedMaintenanceIntervalDays > 0)
|
||||
{
|
||||
equipment.NextScheduledMaintenance = DateTime.UtcNow.AddDays(equipment.RecommendedMaintenanceIntervalDays);
|
||||
equipment.NextScheduledMaintenance = DateTime.UtcNow.AddDays(equipment.RecommendedMaintenanceIntervalDays.Value);
|
||||
}
|
||||
|
||||
equipment.UpdatedAt = DateTime.UtcNow;
|
||||
|
||||
Reference in New Issue
Block a user