public async Task OnGetAsync(long id) { Dto = await _service.GetByIdAsync(id); if (Dto == null) { throw new KuDataNotFoundException(); } }
public async Task OnGetAsync(long?id) { if (id.HasValue) { Dto = await _service.GetByIdAsync(id.Value); if (Dto == null) { throw new KuDataNotFoundException(); } ViewData["Mode"] = "Edit"; } else { Dto = new TimedTaskDto(); Dto.ValidStartTime = DateTime.Now; Dto.ValidEndTime = DateTime.MaxValue; ViewData["Mode"] = "Add"; } }