Task IUpdateContentRepository.UpdateFeed(UpdateFeedViewModel model, string entityId, string userId) { var foundActiveFeed = _context.Set <Feed>().FirstOrDefault(x => x.IsActiveVersion && x.EntityId == entityId); if (foundActiveFeed == null) { return(Task.FromException(new Exception("Feed to update not found."))); } foundActiveFeed.IsActiveVersion = false; foundActiveFeed.Modified = DateTime.Now; _context.Update(foundActiveFeed); _context.SaveChanges(); var newFeed = foundActiveFeed; newFeed.Id = Guid.NewGuid().ToString(); newFeed.IsActiveVersion = true; newFeed.Version = GetNextVersion <Feed>(foundActiveFeed.EntityId); newFeed.Name = model.Name; _context.Add(newFeed); return(_context.SaveChangesAsync()); }
public async Task <GrainOperationResult> UpdateFeed(UpdateFeedViewModel model, string entityId) { try { await _repository.UpdateFeed(model, entityId, GrainUserId); return(new GrainOperationResult { Successful = true, Message = "Operation executed successfully." }); } catch (Exception ex) { return(ex.ResultFromException()); } }