示例#1
0
        public virtual async Task <ActionResult <CallInvolvedUnit> > UpdateCallInvolvedUnit(
            [FromServices] ICallInvolvedUnitManager callInvolvedUnitManager, [FromServices] IMapper mapper,
            [FromRoute][Required] Guid callId,
            [FromBody] UpdateCallInvolvedUnit model)
        {
            Result <CallInvolvedUnitDto> updateResult =
                await callInvolvedUnitManager.UpdateInvolvedUnit(callId, mapper.Map <CallInvolvedUnitDto>(model));

            return(updateResult.Bind(unit => Result.Success(mapper.Map <CallInvolvedUnit>(unit))).ToHttpResult());
        }
示例#2
0
        public virtual async Task <IActionResult> AddCallInvolvedUnit(
            [FromServices] ICallInvolvedUnitManager involvedUnitManager,
            [FromServices] IMapper mapper,
            [FromRoute][Required] Guid callId,
            [FromBody] CreateCallInvolvedUnit model)
        {
            Result <CallInvolvedUnitDto> result =
                await involvedUnitManager.AddUnitToCallAsync(callId, mapper.Map <CallInvolvedUnitDto>(model));

            return(result.Bind(unit => Result.Success(mapper.Map <CallInvolvedUnit>(unit))).ToHttpResult());
        }
示例#3
0
        public virtual async Task <ActionResult <Page <CallInvolvedUnit> > > GetCallInvolvedUnits(
            [FromServices] ICallInvolvedUnitManager callInvolvedUnitManager, [FromServices] IMapper mapper,
            [FromRoute][Required] Guid callId,
            [FromQuery] int?page, [FromQuery] int?count)
        {
            Result <PageDto <CallInvolvedUnitDto> > callInvolvedUnits =
                await callInvolvedUnitManager.GetCallInvolvedUnitsAsync(callId, page, count);

            return(callInvolvedUnits
                   .Bind(selectResult =>
                         Result.Success(mapper.Map <PageDto <CallInvolvedUnitDto>, Page <CallInvolvedUnit> >(selectResult)))
                   .ToHttpResult());
        }