Exemple #1
0
 /// <summary>
 /// EF implementation to (add new) / (update an existing) category for pictures
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public int AddEditCategory(Category category)
 {
     if (category.CategoryId > 0)
     {
         // Update request
         _dbContext.Entry(category).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     }
     else
     {
         // New category
         _dbContext.Add(category);
     }
     _dbContext.SaveChanges();
     return(category.CategoryId);
 }
Exemple #2
0
 /// <summary>
 /// Method implmentation to Update the whole picture record
 /// </summary>
 /// <param name="picture"></param>
 public void EditGifAnimatedToDB(Picture picture)
 {
     _pictureContext.Entry(picture).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _pictureContext.SaveChanges();
 }