Example #1
0
 public void CreateExpCategory(ExpenditureCategory expenditureCategory)
 {
     if (expenditureCategory == null)
     {
         return;
     }
     _fukiziPfmContext.ExpenditureCategories.Add(expenditureCategory);
     _fukiziPfmContext.SaveChanges();
 }
Example #2
0
        public void Update(ExpenditureCategory expenditureCategory)
        {
            var dbCat = _fukiziPfmContext.ExpenditureCategories.FirstOrDefault(e => e.Id == expenditureCategory.Id);

            if (dbCat != null)
            {
                dbCat.Name = expenditureCategory.Name;
            }

            _fukiziPfmContext.SaveChanges();
        }
Example #3
0
 public void Save(ExpenditureCategory expenditureCategory)
 {
     if (expenditureCategory.Id != 0)
     {
         Update(expenditureCategory);
     }
     else
     {
         CreateExpCategory(expenditureCategory);
     }
 }
 public ExpenditureCategory Add(ExpenditureCategory category)
 {
     _dbContext.Categories.Add(category);
     _dbContext.SaveChanges();
     return(category);
 }
 public void Update(ExpenditureCategory category)
 {
     _dbContext.Entry(category).State = EntityState.Modified;
     _dbContext.SaveChanges();
 }