public async Task <IDataResult <Mission> > AddMissionAsync(CreateMissionDTO createMissionDTO) { var uploadResult = await _cloudinaryOperations.UploadImageAsync(createMissionDTO.ImageFile); var mission = _mapper.Map <Mission>(createMissionDTO); await AddMissionWithImageAsync(mission, uploadResult); return(new SuccessfulDataResult <Mission>(mission, HttpStatusCode.Created)); }
public async Task AddMission() { CreateMissionDTO _createMissionDTO = new CreateMissionDTO { Content = "İçerik 6", Difficulty = 2, Title = "Hayvanlara yardım 6" }; // Arrange MissionManager _missionService = new MissionManager(_mockMissionDal.Object, _mapper, _mockEvidenceService.Object, _mockCloudinaryOperations.Object); // Act await _missionService.AddMissionAsync(_createMissionDTO); // Assert Assert.IsNotNull(_missions.Find(m => m.Content == _createMissionDTO.Content)); }
public async Task <IActionResult> CreateMission([FromForm] CreateMissionDTO createMissionDTO) { var result = await _missionService.AddMissionAsync(createMissionDTO); return(StatusCode(result.HttpStatusCode, result.Data)); }