public async Task Reschedule(WorkItemViewModel model)
 {
     await this.workItemService.Reschedule(new Infrastructure.WorkItemDto
     {
         Id      = model.Id,
         DueDate = model.DueDate
     });
 }
Exemple #2
0
        public async Task <int> Reschedule(WorkItemViewModel model)
        {
            var item = await _context.WorkItems.FindAsync(model.Id);

            item.Retries = Constants.WORKITEM_RETRIES; // so it reschedules only once!
            if (model.DueDate.HasValue)
            {
                item.DueDate = model.DueDate.Value;
            }

            _context.WorkItems.Update(item);

            return(await _context.SaveChangesAsync());
        }
        public async Task <ActionResult> Reschedule([FromBody] WorkItemViewModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }
            if (!this.ModelState.IsValid)
            {
                return(BadRequest(this.ModelState));
            }

            await this._workItemService.Reschedule(model);

            return(NoContent());
        }