示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
 public async Task <Picture> UpdateAsync(PictureUpdateModel picture)
 {
     return(await this.PictureDAL.UpdateAsync(picture));
 }