public async Task <MyWebApp.Domain.Picture> InsertAsync(PictureUpdateModel picture) { var result = await this.Context.AddAsync(this.Mapper.Map <Picture>(picture)); await this.Context.SaveChangesAsync(); return(this.Mapper.Map <MyWebApp.Domain.Picture>(result.Entity)); }
public async Task <MyWebApp.Domain.Picture> UpdateAsync(PictureUpdateModel picture) { var existing = await this.Get(Picture); var result = this.Mapper.Map(picture, existing); this.Context.Update(result); await this.Context.SaveChangesAsync(); return(this.Mapper.Map <MyWebApp.Domain.Picture>(result)); }
public async Task CreateAsync_PictureValidationSucceed_CreatesStreet() { // Arrange var picture = new PictureUpdateModel(); var expected = new Picture(); var pictureDAL = new Mock <IPictureDAL>(); pictureDAL.Setup(x => x.InsertAsync(disease)).ReturnsAsync(expected); var pictureService = new pictureService(pictureDAL.Object); // Act var result = await pictureService.CreateAsync(picture); // Assert result.Should().Be(expected); }
public async Task <Picture> UpdateAsync(PictureUpdateModel picture) { return(await this.PictureDAL.UpdateAsync(picture)); }