コード例 #1
0
ファイル: ArticleService.cs プロジェクト: cyroul82/ASPNETCORE
        public async Task SaveArticle(ArticleViewModel article)
        {
            using (var c = _dBConnector.GetIDBConnector())
            {
                //string sql = @"UPDATE Article set name=@name, imagepath=@imagepath, isbn=@isbn, description=@description, url=@url, email=@email, date=@date, price=@price where id=@id";

                //var item = await c.ExecuteAsync(sql, new
                //{
                //    isbn = article.ISBN,
                //    name = article.Name,
                //    description = article.Description,
                //    url = article.Url,
                //    imagepath = article.ImagePath,
                //    email = article.Email,
                //    price = article.Price,
                //    date = article.Date,
                //    id = article.Id,

                //});

                c.Update(new ArticleViewModel {
                    Id          = article.Id,
                    ISBN        = article.ISBN,
                    Name        = article.Name,
                    Description = article.Description,
                    Url         = article.Url,
                    ImagePath   = article.ImagePath,
                    Email       = article.Email,
                    Date        = article.Date,
                    Price       = article.Price
                });
            }
        }