public async Task <Result <DeleteAppointmentReason> > Handle(DeleteAppointmentCommand request, CancellationToken cancellationToken) { using (_commontUnitOfWork) { try { var result = await _commontUnitOfWork.Repository <PatientAppointment>() .Get(x => x.Id == request.AppointmentId && x.DeleteFlag == false).ToListAsync(); if (result.Count > 0) { result[0].DeleteFlag = true; _commontUnitOfWork.Repository <PatientAppointment>().Update(result[0]); await _commontUnitOfWork.SaveAsync(); } return(Result <DeleteAppointmentReason> .Valid(new DeleteAppointmentReason() { Message = "Successfully deleted appointment" })); } catch (Exception e) { Log.Error(e, $"Could not delete appointmentId: {request.AppointmentId}"); return(Result <DeleteAppointmentReason> .Invalid($"Could not delete appointmentId: {request.AppointmentId}")); } } }
public async Task <IActionResult> Delete(long appointmentId) { var command = new DeleteAppointmentCommand(appointmentId); await mediator.Send(command); return(NoContent()); }
public async Task <IActionResult> Delete([FromForm] DeleteAppointmentCommand command) { await Mediator.Send(command); return(this.Redirect($"/User/Profile/{command.UserId}")); }
public async Task <ActionResult> DeleteAppointment([FromBody] DeleteAppointmentCommand command) { var appointment = await Mediator.Send(command); return(Ok(appointment)); }
public async Task <ActionResult <bool> > DeletePostAsync([FromBody] DeleteAppointmentCommand command) { var result = await _mediator.Send(command); return(Ok(ResponseWrapper.CreateOkResponseWrapper(result))); }
public async Task <IActionResult> Delete(DeleteAppointmentCommand command) { return(Ok(await bus.Send(command))); }