Exemplo n.º 1
0
        public override async Task <int> DeleteDataAsync(Option entity)
        {
            string sql    = @"DELETE FROM Option WHERE Id = @id";
            int    result = await ConnectData.ExecuteAsync(sql, entity.Id);

            return(result);
        }
Exemplo n.º 2
0
        public override async Task <int> InsertDataAsync(Option entity)
        {
            string sql = @"INSER INTO Option
                            (StrKey,
                            StrValue,
                            IsApplied,
                            DateCreate,
                            UserModified) 
                            VALUES (@key, @val, @isApplied, @createDate, @userName)";

            int result = await ConnectData.ExecuteAsync(sql, new { entity.StrKey, entity.StrValue, entity.IsApplied, entity.DateCreate, entity.UserModified });

            return(result);
        }
Exemplo n.º 3
0
        public override async Task <int> UpdateDataAsync(Option entity)
        {
            string sql = @"UPDATE Option SET 
                            StrKey = @key,
                            StrValue = @val,
                            IsApplied = @isApplied,
                            DateCreate = @createDate,
                            DateUpdate = @createUpdate,
                            UserModified = @userName
                            WHERE Id = @id";

            int result = await ConnectData.ExecuteAsync(sql, new { entity.StrKey, entity.StrValue, entity.IsApplied, entity.DateCreate, entity.DateUpdate, entity.UserModified, entity.Id });

            return(result);
        }
Exemplo n.º 4
0
        public override async Task <int> InsertDataAsync(Post entity)
        {
            string sql = @"INSER INTO Post
                            (Title,
                            Excerpt,
                            Content,
                            AuthorId,
                            ImageUrl,
                            DateCreate,
                            IsAvailable) 
                            VALUES (@title, @excrept, @content, @author, @image, @createDate, @isAvailable)";

            int result = await ConnectData.ExecuteAsync(sql, new { entity.Title, entity.Excerpt, entity.Content, entity.AuthorId, entity.ImageUrl, entity.DateCreate, entity.IsAvailable });

            return(result);
        }
Exemplo n.º 5
0
        public override async Task <int> UpdateDataAsync(Post entity)
        {
            string sql = @"UPDATE Post SET 
                            Title = @title,
                            Excerpt = @excrept,
                            Content = @content,
                            AuthorId =  @author,
                            ImageUrl =  @image,
                            DateCreate = @createDate,
                            DateUpdate = @createUpdate,
                            IsAvailable = @available
                            WHERE Id = @id";

            int result = await ConnectData.ExecuteAsync(sql, new { entity.Title, entity.Excerpt, entity.Content, entity.AuthorId, entity.ImageUrl, entity.DateCreate, entity.DateUpdate, entity.IsAvailable, entity.Id });

            return(result);
        }