﻿using GIELIE.Data.DTO.ResponseObjects;
using GIELIE.Data.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GIELIE.Data.Repositories
{
    public class CategoryRepository
    {
        public GielieContext _context;

        public CategoryRepository()
        {
            _context = new GielieContext();
        }

        public Category Save(Category category)
        {
            try
            {
                if (category != null)
                {
                    _context.Categories.Add(category);
                    _context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return category;
        }
    }
}
