public int DeleteCategory(Category category)
        {
            rpt_category rpt_category = _db.rpt_category.Where(rpt => rpt.Id == category.Id).FirstOrDefault();

            if (rpt_category != null)
            {
                _db.rpt_category.Remove(rpt_category);
                return(_db.SaveChanges());
            }
            return(0);
        }
        public int UpdateCategory(Category category)
        {
            rpt_category rpt_category = _db.rpt_category.Where(rpt => rpt.Id == category.Id).FirstOrDefault();

            if (rpt_category != null)
            {
                _db.rpt_category.Attach(rpt_category);
                rpt_category.Catrgoryname = category.CategoryName;
                return(_db.SaveChanges());
            }
            return(0);
        }
 public int AddCategory(Category category)
 {
     try
     {
         rpt_category rpt_category = new rpt_category();
         rpt_category.Id           = category.Id;
         rpt_category.Catrgoryname = category.CategoryName;
         _db.rpt_category.Add(rpt_category);
         return(_db.SaveChanges());
     }
     catch (Exception ex)
     {
         BugLog.Write(ex.ToString());
         return(0);
     }
 }