/// <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); }
/// <summary> /// Method implementation to Add a new picture into the database /// </summary> /// <param name="picture"></param> public void AddGifAnimatedToDB(Picture picture) { _pictureContext.Add(picture); _pictureContext.SaveChanges(); }
/// <summary> /// Method implementation to Register to the Database /// </summary> /// <param name="user"></param> public void AddUserRegistration(User user) { _userContext.Add(user); _userContext.SaveChanges(); }