public async void AddTeamImages() { try { var teamImagesDto = new TeamImagesDto() { TeamId = 1, DateCreated = DateTime.UtcNow, IsActive = true, Images = new List <ImageDto>() { new ImageDto() { Url = "https://tppapp.blob.core.windows.net/content/Images/Edit_BG.jpg" }, new ImageDto() { Url = "https://tppapp.blob.core.windows.net/content/Images/ChelseaFC_Logo.png" } } }; var result = await _service.AddTeamImages(teamImagesDto); Assert.Equal(true, result); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <IActionResult> AddTeamImages([FromBody, Required] TeamImagesDto teamImages) { try { if (teamImages == null) { return(BadRequest()); } if (await _service.AddTeamImages(teamImages)) { return(CreatedAtRoute("default", true)); } return(BadRequest("Failed to update the database")); } catch (Exception ex) { Log.Error(ex, ex.Message); return(BadRequest(ex.Message)); } }