Esempio n. 1
0
        public async Task <long> UpdateReply(ReplyDto model)
        {
            var replyToUpdate = await _skinHubAppDbContext.Reply.FindAsync(model.ID);

            if (replyToUpdate != null)
            {
                _skinHubAppDbContext.Entry(replyToUpdate).State = EntityState.Modified;
                await _skinHubAppDbContext.SaveChangesAsync();

                return(model.ID);
            }
            return(0);
        }
Esempio n. 2
0
        public async Task <long> UpdateComment(CommentDto model)
        {
            var CommentToUpdate = await _skinHubAppDbContext.Comment.FindAsync(model.ID);

            if (CommentToUpdate != null)
            {
                _skinHubAppDbContext.Entry(CommentToUpdate).State = EntityState.Modified;
                await _skinHubAppDbContext.SaveChangesAsync();

                return(model.ID);
            }
            return(0);
        }
        public async Task <int> UpdateProductListType(ProductListTypeDto model)
        {
            var productToUpdate = await _skinHubAppDbContext.ProductType.FindAsync(model.ID);

            if (productToUpdate != null)
            {
                productToUpdate.Name = model.Name;

                _skinHubAppDbContext.Entry(productToUpdate).State = EntityState.Modified;
                await _skinHubAppDbContext.SaveChangesAsync();

                return(model.ID);
            }
            return(0);
        }
Esempio n. 4
0
        public async Task <int> UpdateColorType(ColorTypeDto model)
        {
            var colorToUpdate = await _skinHubAppDbContext.ColorType.FindAsync(model.ID);

            if (colorToUpdate != null)
            {
                colorToUpdate.Name = model.Name;

                _skinHubAppDbContext.Entry(colorToUpdate).State = EntityState.Modified;
                await _skinHubAppDbContext.SaveChangesAsync();

                return(model.ID);
            }
            return(0);
        }