public IHttpActionResult UpdateIntakeServices(OrdersTransfereeIntakeServicesDto dto) { var userId = User.Identity.GetUserId(); Order order = _unitOfWork.Orders.GetOrderFor(userId, dto.Id, User.GetUserRole()); if (order == null) { return(NotFound()); } foreach (var serviceDto in dto.Services) { var service = order.Services.FirstOrDefault(s => !String.IsNullOrEmpty(serviceDto.Id) && s.Id == serviceDto.Id); if (service == null) { return(NotFound()); } else { _mapper.Map <OrdersTransfereeIntakeServiceDto, Service>(serviceDto, service); } } _unitOfWork.Complete(); return(Ok()); }
public void UpsertIntakeServices_NoOrder_ReturnNotFound() { var orderId = "1"; Order order = null; _mockRepository.Setup(r => r.GetOrderFor(_userId, orderId, UserRoles.Consultant)).Returns(order); var dto = new OrdersTransfereeIntakeServicesDto() { Id = orderId }; var result = _controller.UpdateIntakeServices(dto) as IHttpActionResult; result.Should().BeOfType <System.Web.Http.Results.NotFoundResult>(); }