public async override void Execute(object parameter) { var forumEntity = (ForumEntity)parameter; using (var db = new FavoriteForumContext()) { db.Delete(forumEntity); await db.SaveChangesAsync(); Locator.ViewModels.MainForumsPageVm.GetFavoriteForums(); } }
public async override void Execute(object parameter) { var forumEntity = (ForumEntity)parameter; if (Locator.ViewModels.MainForumsPageVm.FavoriteForumGroupList.First().ForumList.Any(forum => forum.ForumId == forumEntity.ForumId)) { return; } using (var db = new FavoriteForumContext()) { db.Add(forumEntity); await db.SaveChangesAsync(); Locator.ViewModels.MainForumsPageVm.GetFavoriteForums(); } }