コード例 #1
0
        internal int DeleteStory(StoryModel model)
        {
            int i = 0;

            _connection.Open();
            try
            {
                using (MySqlCommand cmd = _connection.CreateCommand() as MySqlCommand)
                {
                    string sSQL = "delete from story where chapter=@CHAPTER and section=@SECTION";

                    cmd.Parameters.AddWithValue("CHAPTER", model.chapter);
                    cmd.Parameters.AddWithValue("SECTION", model.section);

                    cmd.CommandText = sSQL;
                    i = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _connection.Close();
            }
            return(i);
        }
コード例 #2
0
        private void OnGUI()
        {
            Event e = Event.current;

            BeginWindows();
            ViewpointMovement(e);

            if (_story == null)
            {
                _story = GetDefaultGameSettingsFromDatabase()?.Story;
            }
            if (_story == null)
            {
                Debug.LogError("Unable to load default story.");
                return;
            }
            if (_nodes == null)
            {
                _nodes = GetNodesFromDatabase(_story);
            }
            _drawnSegments = new List <StorySegmentModel>();

            DrawHeader();


            DrawNodes(e);

            EndWindows();
            NodeMovement(e);
            NodeExitSelection(e);
        }
コード例 #3
0
        internal int InsertStory(StoryModel model)
        {
            int i = 0;

            _connection.Open();
            try
            {
                using (MySqlCommand cmd = _connection.CreateCommand() as MySqlCommand)
                {
                    string sSQL = "insert into story";

                    sSQL += " (chapter, section, seq, title, storyContent_ch, storyContent_kr, lastModified)";
                    sSQL += " VALUES";
                    sSQL += " (@CHAPTER, @SECTION, @SEQ, @TITLE, @STORYCONTENT_CH, @STORYCONTENT_KR, @LASTMODIFIED)";
                    cmd.Parameters.AddWithValue("CHAPTER", model.chapter);
                    cmd.Parameters.AddWithValue("SECTION", model.section);
                    cmd.Parameters.AddWithValue("SEQ", model.seq);
                    cmd.Parameters.AddWithValue("TITLE", model.title);
                    cmd.Parameters.AddWithValue("STORYCONTENT_CH", model.storyContent_ch);
                    cmd.Parameters.AddWithValue("STORYCONTENT_KR", model.storyContent_kr);
                    cmd.Parameters.AddWithValue("LASTMODIFIED", DateTime.Now);

                    cmd.CommandText = sSQL;
                    i = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex) {
                throw ex;
            }
            finally
            {
                _connection.Close();
            }
            return(i);
        }
コード例 #4
0
ファイル: StoryController.cs プロジェクト: linxscc/LoveGame
    public override void Start()
    {
        _storyModel = GetData <StoryModel>();

//        if(_storyModel.Level==null)
//        {
//            return;
//        }
//
//        int step = -1;
//        if (_storyModel.Level.IsPass == false)
//        {
//            switch (_storyModel.Level.LevelMark)
//            {
//                case "1-2":
//                    step = GuideConst.MainStep_MainStory1_2_Start;
//                    break;
//                case "1-3":
//                    step = GuideConst.MainStep_MainStory1_3_Start;
//                    break;
//                case "1-4":
//                    step = GuideConst.MainStep_MainStory1_4_Start;
//                    break;
//            }
//
//            if(step != -1)
//            {
//                GuideManager.SetRemoteGuideStep(GuideTypePB.MainGuide, step);
//            }
//        }
    }
コード例 #5
0
        public async Task <IActionResult> Create(StoryModel model)
        {
            string userId = HttpContext.User.FindUserId();

            if (userId == null)
            {
                return(Unauthorized());
            }

            if (!await freeLimits.CanCreateStoryAsync(userId))
            {
                return(PremiumRequired());
            }

            Story entity = new Story();

            MapModelToEntity(model, entity);
            entity.UserId = userId;
            entity.Order  = await db.Stories.CountAsync(s => s.UserId == userId) + 1;

            entity.Created = DateTime.Now;

            await db.Stories.AddAsync(entity);

            await db.SaveChangesAsync();

            MapEntityToModel(entity, model);
            return(CreatedAtAction(nameof(Get), new { id = entity.Id }, model));
        }
コード例 #6
0
ファイル: TaskPresenter.cs プロジェクト: hamk-uas/vikke-game
    /// <summary>
    /// Defauly constructor
    /// </summary>
    /// <param name="taskView">Reference of the view for this class</param>
    public TaskPresenter(TaskView taskView)
    {
        _taskView = taskView;

        //Fetch the model instances
        _locationModel = LocationModel.GetInstance();
        _storyModel    = StoryModel.GetInstance();
        //Get the active story
        _activeStory = _storyModel.GetActiveStory();
        //Get the active task
        _task = _locationModel.GetLocationTask();

        //Apply image content depending on of the task has an image or not
        if (_task.taskviewSprite != null)
        {
            _taskView.SetTaskContent(_task.GetLocalizedTitle(), _task.taskviewSprite, _task.GetLocalizedText());
        }
        else
        {
            _taskView.SetTaskContent(_task.GetLocalizedTitle(), _task.GetLocalizedText());
        }

        //Display the AR scanner button if the task has AR content
        _taskView.SetARScannerBtnActive(_task.isARTask);
    }
コード例 #7
0
        /// <summary>
        /// Method to add the Story
        /// </summary>
        /// <param name="model"></param>
        public void SaveStory(StoryModel model)
        {
            using (LBCData context = new LBCData(ConnectionHelper.getConnectionString()))
            {
                LBC_STORY _story = new LBC_STORY()
                {
                    STARS_ID          = model.STARS_ID,
                    PA_CODE           = model.PA_CODE,
                    STORY_TITLE       = model.STORY_TITLE,
                    STORY_CONTENT     = model.STORY_CONTENT,
                    STORY_RATING      = model.STORY_RATING,
                    STORY_STATUS      = model.STORY_STATUS,
                    STORY_CATEGORY    = model.STORY_CATEGORY,
                    STORY_SUBCATEGORY = model.STORY_SUBCATEGORY,
                    SUBMISION_DATE    = model.SUBMISION_DATE,
                    IMG_1             = model.IMG_1,
                    IMG_2             = model.IMG_2,
                    IMG_3             = model.IMG_3,
                    CREATED_DATE      = model.CREATED_DATE,
                    CREATED_BY        = model.CREATED_BY
                };

                context.LBC_STORY.Add(_story);
                context.SaveChanges();
            }
        }
コード例 #8
0
        public void EditStory(StoryModel model)
        {
            var status = statusCollection.Find(it => it.StatusName == model.StatusName).FirstOrDefault();

            if (status != null && status.IsWorkDone)
            {
                model.WorkDoneDate = DateTime.Now;
            }
            else
            {
                model.WorkDoneDate = null;
            }

            storyCollection.FindOneAndUpdate(
                Builders <StoryModel> .Filter.Eq(it => it._id, model._id),
                Builders <StoryModel> .Update
                .Set(it => it.Name, model.Name)
                .Set(it => it.Description, model.Description)
                .Set(it => it.WorkReport, model.WorkReport)
                .Set(it => it.AssginByMember_id, model.AssginByMember_id)
                .Set(it => it.BeAssignedMember_id, model.BeAssignedMember_id)
                .Set(it => it.StatusName, model.StatusName)
                .Set(it => it.WorkDoneDate, model.WorkDoneDate)
                .Set(it => it.ClosingDate, DateTime.SpecifyKind(model.ClosingDate, DateTimeKind.Local))
                );

            assignSvc.UpdateAssignment(model._id, model.BeAssignedMember_id, model.StatusName, WorkType.Story);
        }
コード例 #9
0
        public IActionResult DeleteStory(StoryModel storyModel)
        {
            StoryDAO dao = new StoryDAO(_connection);
            int      i   = dao.DeleteStory(storyModel);

            if (i > 0)
            {
                ViewData["alertType"] = "alert alert-success";
                ViewData["MSG"]       = "刪除成功";
                //刪除成功時顯示新增模式
                ViewData["EditMode"] = "insert";
            }
            else
            {
                ViewData["alertType"] = "alert alert-danger";
                ViewData["MSG"]       = "刪除失敗";
                //刪除失敗時維持更新模式
                ViewData["EditMode"] = "update";
            }

            //EditStory頁面所需資料
            List <StoryModel> storyList = dao.GetStoryList();

            ViewData.Add("StoryList", storyList);

            return(View("~/Views/Story/EditStory.cshtml", storyModel));
        }
コード例 #10
0
        public async Task <IActionResult> EditStory(StoryModel request)
        {
            if (ModelState.IsValid)
            {
                var result = await _WorkSVC.UpdateStory(request, User);

                if (!result)
                {
                    ViewBag.ErrorMessage = "ไม่สามารถแก้ไขข้อมูลงานรองได้ กรุณาตรวจสอบข้อมูล";
                    var qry = await _membershipSVC.GetMemberships(request.Project_id);

                    ViewBag.AssignmentList = qry.Select(it => it.MemberUserName);
                    return(View(request));
                }
                return(RedirectToAction(nameof(Detail), new { id = request.Project_id }));
            }
            else
            {
                ViewBag.ErrorMessage = "ไม่สามารถแก้ไขข้อมูลงานรองได้ กรุณาตรวจสอบข้อมูล";
                var qry = await _membershipSVC.GetMemberships(request.Project_id);

                ViewBag.AssignmentList = qry.Select(it => it.MemberUserName);
                return(View(request));
            }
        }
コード例 #11
0
        public async Task AppendToStory(string drawingId)
        {
            if (!AuthService.IsLoggedIn)
            {
                Logger.Error($"Tried adding drawing ${drawingId} to Story while logged out.");
                return;
            }

            Logger.Info($"Adding drawing ${drawingId} to Story for user ${AuthService.CurrentUser.DisplayName}");

            var story = await GetStory(AuthService.CurrentUser.Id);

            if (!IsStoryValid(story))
            {
                story = new StoryModel
                {
                    ExpirationDate = DateTime.Now.AddSeconds(Constants.StoryDurationInSeconds),
                    Drawings       = new Dictionary <string, int>()
                };
            }

            var nextIndex = story.Drawings.Count == 0 ? 0 : story.Drawings.Values.Max() + 1;

            story.Drawings[drawingId] = nextIndex;

            await DatabaseService.Ref(DatabasePaths.Stories)
            .Child(AuthService.CurrentUser.Id)
            .Set(story);
        }
コード例 #12
0
        private StoryModel MapModelFromLBC_Story(StoryModel entity)
        {
            StoryModel model = new StoryModel();

            if (entity != null)
            {
                model = (StoryModel)entity;
                //model.SEQ_ID = entity.SEQ_ID;
                //model.STARS_ID = entity.STARS_ID;
                //model.PA_CODE = entity.PA_CODE;
                //model.STORY_TITLE = entity.STORY_TITLE;
                //model.STORY_CONTENT = entity.STORY_CONTENT;
                //model.STORY_RATING = entity.STORY_RATING;
                //model.STORY_STATUS = entity.STORY_STATUS;
                //model.STORY_CATEGORY = entity.STORY_CATEGORY;
                //model.STORY_SUBCATEGORY = entity.STORY_SUBCATEGORY;
                //model.IMG_1 = entity.IMG_1;
                //model.IMG_2 = entity.IMG_2;
                //model.IMG_3 = entity.IMG_3;
                //model.CREATED_DATE = entity.CREATED_DATE;
                //model.CREATED_BY = entity.CREATED_BY;
                //model.UPDATED_BY = entity.UPDATED_BY;
                //model.UPDATED_DATE = entity.UPDATED_DATE;
                //model.SUBMISION_DATE = entity.SUBMISION_DATE;
            }

            return(model);
        }
コード例 #13
0
        private async Task <DetailedStoryModel> ToDetailedStoryModel(string userId, StoryModel story)
        {
            if (!AuthService.IsLoggedIn)
            {
                Logger.Error($"Tried converting Story of user ${userId} to DetailedStory while logged out.");
                return(null);
            }

            Logger.Info($"Converting Story of user ${userId} to DetailedStory for user ${AuthService.CurrentUser.DisplayName}");

            var owner = await ProfileService.GetProfile(userId);

            var items = story?.Drawings?.ToList();

            items.Sort((x, y) => x.Value - y.Value);
            var orderedDrawingIds = new List <string>(items.Select(x => x.Key));

            var drawingPreviewUrls = new List <string>();

            foreach (var drawingId in orderedDrawingIds)
            {
                var drawingInfo = await DrawingService.GetDrawingInfo(drawingId);

                drawingPreviewUrls.Add(drawingInfo?.PreviewUrl);
            }

            return(new DetailedStoryModel()
            {
                Owner = owner,
                Drawings = story?.Drawings,
                ExpirationDate = story?.ExpirationDate ?? DateTime.Now,
                DrawingPreviewUrls = drawingPreviewUrls
            });
        }
コード例 #14
0
        public static void Main(string[] args)
        {
            // Load story file
            string     storyJson = File.ReadAllText("Stories/musgraveritual.json");
            StoryModel model     = StoryModel.Create(storyJson);

            // Load story into player
            StoryPlayer player = new StoryPlayer(model, new Inklewriter.MarkupConverters.ConsoleMarkupConverter());

            // Display header
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine(player.Title);
            Console.WriteLine("by " + player.Author);

            // Main loop
            Stitch lastStitch = player.InitialStitch;

            while (lastStitch != null)
            {
                Console.WriteLine();
                DrawHorizontalLine();
                Console.WriteLine();

                var nextChunk = player.CreateChunkForStitch(lastStitch);
                lastStitch = DisplayChunk(nextChunk);
            }
        }
コード例 #15
0
        private void GetNewChapter(StoryModel story, List <ChapterModel> list)
        {
            try
            {
                var link            = story.Link + "/chuong-1";
                var linkNextChapter = string.Empty;

                linkNextChapter = GetChapter(list, link);

                if (!string.IsNullOrEmpty(linkNextChapter))
                {
                    var firstItem = list.FirstOrDefault();
                    firstItem.Link = link;

                    ProcessChapters(list, linkNextChapter);
                }
                else
                {
                    logger.Error("Cannot get first chapter - link error");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
コード例 #16
0
        public ActionResult BrowseContributorStories()
        {
            BrowseStoryModel model = new BrowseStoryModel();


            storiesAvailable = new List <StoryModel>();
            var        username = "******";
            GetStories storyobj = new GetStories();

            var results = storyobj.getContributorStories(username);

            for (int i = 0; i < results.Count; i++)
            {
                StoryModel story = new StoryModel();
                story.Title   = results[i].Title;
                story.Content = results[i].Content;
                storiesAvailable.Add(story);
            }

            ViewBag.GenreValue = "Select";
            ViewBag.TypeValue  = "Type";


            model.GenreValues = HomeControllerUtilities.GetGenres();
            model.TypeValues  = HomeControllerUtilities.GetTypes();

            model.Stories = storiesAvailable;
            return(View(model));
        }
コード例 #17
0
        private void GetCurrentChapter(StoryModel story, List <ChapterModel> list)
        {
            using (var scope = _scopeFactory.CreateReadOnly())
            {
                var context = scope.DbContexts.Get <MainContext>();

                var currentChapter = context.Set <Chapter>().Where(f => f.StoryId == story.Id).OrderByDescending(o => o.NumberChapter).FirstOrDefault();

                if (currentChapter != null)
                {
                    HtmlDocument document = htmlWeb.Load(currentChapter.Link);

                    var nextChapter = document.DocumentNode.QuerySelectorAll("a#btnNextChapter").FirstOrDefault();

                    if (nextChapter != null)
                    {
                        var linkNextChapter = nextChapter.Attributes["href"].Value;

                        if (!string.IsNullOrEmpty(linkNextChapter))
                        {
                            var url = Constants.UrlWiki + linkNextChapter;

                            ProcessChapters(list, url);
                        }
                    }
                    else
                    {
                        logger.Info("This chapter is latest");
                    }
                }
            }
        }
コード例 #18
0
        public async Task <IActionResult> AddStory(StoryModel model, string text)
        {
            if (ModelState.IsValid)
            {
                string path   = "wwwroot/static/stories/";
                int    number = GetLast();
                path += number;

                model.StoryID  = number;
                model.StoryImg = number + ".jpg";

                /*using (var fileStream = new FileStream("wwwroot/img/stories/" + number + ".jpg", FileMode.Create))
                 * {
                 *  await file.CopyToAsync(fileStream);
                 * }*/

                _context.Add(model);
                await _context.SaveChangesAsync();

                StreamWriter writer = new StreamWriter(path + ".html", false);

                writer.WriteLine(text);

                writer.Close();
            }

            return(View());
        }
コード例 #19
0
        public bool Edit(StoryModel story)
        {
            try
            {
                if (story != null && story.GroupIds.Count() > 0)
                {
                    unit.StoryRepository.Edit(new Story
                    {
                        Id          = story.Id,
                        Title       = story.Title,
                        Description = story.Description,
                        Content     = story.Content,
                        Groups      = story.GroupIds.Select(s => unit.GroupRepository.GetByID(s)).ToArray()
                    });

                    unit.Save();

                    return(true);
                }
            }
            catch (Exception ex)
            {
            }

            return(false);
        }
コード例 #20
0
        public void StoryModel_Set_Active_Story_Test()
        {
            //Fetch stories and get the first one from the list
            Story initialStory = GetStories()[0];
            Story newStory     = GetStories()[1];

            //Create a new StoryModel
            new StoryModel(initialStory);
            //Test that the Instance gets initialized properly
            StoryModel storyModel = StoryModel.GetInstance();

            //Change active story in Model
            storyModel.SetActiveStory(newStory);

            //Fetch a list of locations from the model
            List <Location> modelLocations = storyModel.GetStoryLocations();

            //Iterate through the locations fetched from Model
            int i = 0;

            foreach (var location in modelLocations)
            {
                //Check that all locations match
                Assert.AreSame(newStory.locations[i], modelLocations[i]);
                i++;
            }
        }
コード例 #21
0
        public void Test()
        {
            List <FlagValue> flags = new List <FlagValue> {
                new FlagValue("a", false),
                new FlagValue("b", true),
                new FlagValue("c", 10),
            };

            Assert.IsTrue(StoryModel.Test("a == false", flags));
            Assert.IsFalse(StoryModel.Test("a == true", flags));
            Assert.IsTrue(StoryModel.Test("b == true", flags));
            Assert.IsFalse(StoryModel.Test("b == false", flags));
            Assert.IsTrue(StoryModel.Test("b == 1", flags));
            Assert.IsFalse(StoryModel.Test("b == 2", flags));
            Assert.IsTrue(StoryModel.Test("c == 10", flags));
            Assert.IsFalse(StoryModel.Test("c != 10", flags));
            Assert.IsTrue(StoryModel.Test("c < 11", flags));
            Assert.IsTrue(StoryModel.Test("c > 9", flags));
            Assert.IsFalse(StoryModel.Test("c > 11", flags));
            Assert.IsFalse(StoryModel.Test("c < 9", flags));
            Assert.IsTrue(StoryModel.Test("c <= 10", flags));
            Assert.IsTrue(StoryModel.Test("c >= 10", flags));

            // TODO create a custom exception type
            Assert.Throws <System.Exception> (() => StoryModel.Test("a < true", flags));
        }
コード例 #22
0
        public bool Add(StoryModel story)
        {
            try
            {
                if (story != null && story.GroupIds.Count() > 0)
                {
                    unit.StoryRepository.Insert(new Story
                    {
                        Title       = story.Title,
                        Description = story.Description,
                        Content     = story.Content,
                        CreatorId   = story.CreatorId,
                        PostedOn    = DateTime.UtcNow,
                        Groups      = story.GroupIds.Select(s => unit.GroupRepository.GetByID(s)).ToArray()
                    });

                    unit.Save();

                    return(true);
                }
            }
            catch (Exception ex)
            {
            }

            return(false);
        }
コード例 #23
0
        /// <summary>
        /// Method to add/update stories
        /// </summary>
        /// <param name="data">input values to add/update</param>
        /// <returns>updated list of stories</returns>
        public ActionResult AddUpdate(string data, int projectId)
        {
            StoryModel story       = new StoryModel(this.iStoryBaseModel);
            var        storyObject = JsonConvert.DeserializeObject <StoryObjects>(data);

            storyObject.ProjectId = projectId;
            storyObject.CreatedBy = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var res = story.AddUpdateStory(storyObject);

            if (res.IsSuccess)
            {
                return(this.Json(new
                {
                    status = true,
                    message = res.IsNewRecord ? "New story added successfully." : "Story details updated successfully.",
                }));
            }
            else
            {
                return(this.Json(new
                {
                    status = false,
                    message = "Unexpected error occurred."
                }));
            }
        }
コード例 #24
0
        /// <summary>
        /// Create a story
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private StoryModel CreateStory(int id)
        {
            var story = new StoryModel
            {
                StoryId = id,
                Title   = $"Story title {id}",
            };


            const int conversationToDo = 3;

            for (var i = 0; i <= conversationToDo; i++)
            {
                if (i != conversationToDo)
                {
                    story.Conversations.Add(CreateConversation(i));
                }
                else
                {
                    story.Conversations[i - 1].StoryLeadId = i;
                }
            }

            return(story);
        }
コード例 #25
0
        public async Task <bool> UpdateStory(StoryModel request, ClaimsPrincipal User)
        {
            var isDataValid = request != null &&
                              !string.IsNullOrEmpty(request._id) &&
                              !string.IsNullOrEmpty(request.WorkName) &&
                              User != null;

            if (!isDataValid)
            {
                return(false);
            }

            var Username          = _UserManager.GetUserName(User);
            var member_collection = database.GetCollection <MembershipModel>(mongoDB.MembershipCollection);
            var beMember          = await member_collection.FindAsync(it => it.MemberUserName == Username && it.Project_id == request.Project_id);

            var member = beMember.FirstOrDefault();

            if (member == null)
            {
                return(false);
            }

            request.AssignBy = member.MemberUserName;

            var story_collection = database.GetCollection <StoryModel>(mongoDB.StoryCollection);
            await story_collection.ReplaceOneAsync(it => it._id == request._id, request);

            return(true);
        }
コード例 #26
0
 private BlogModel GetBlogModel(long id)
 {
     try
     {
         BlogModel blogModel = new BlogModel();
         Blog      blog      = db.Blogs.Where(x => x.id == id).SingleOrDefault();
         if (blog != null)
         {
             blogModel.background = blog.backgroundColor;
             blogModel.header     = blog.header;
             List <Story> stories = db.Stories.Where(x => x.blogID == id).ToList();
             if (stories != null)
             {
                 List <StoryModel> storyModels = new List <StoryModel>();
                 foreach (Story story in stories)
                 {
                     StoryModel storyModel = new StoryModel();
                     storyModel.body  = story.body;
                     storyModel.title = story.title;
                     storyModel.image = story.image;
                     storyModels.Add(storyModel);
                 }
                 blogModel.stories = storyModels;
             }
         }
         return(blogModel);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(null);
     }
 }
コード例 #27
0
 public async Task InsertTestStory()
 {
     try
     {
         StoryModel story = new StoryModel();
         story.Name = "Story of Darth Plageuis";
         List <string> msgs = new List <string>();
         msgs.Add("Did you ever hear the tragedy of Darth Plagueis The Wise?");
         msgs.Add("I thought not. It’s not a story the Jedi would tell you.");
         msgs.Add("It’s a Sith legend.");
         msgs.Add("Darth Plagueis was a Dark Lord of the Sith,");
         msgs.Add("so powerful and so wise he could use the Force");
         msgs.Add("to influence the midichlorians to create life…");
         msgs.Add("He had such a knowledge of the dark side that");
         msgs.Add("he could even keep the ones he cared about from dying.");
         msgs.Add("The dark side of the Force is a pathway");
         msgs.Add("to many abilities some consider to be unnatural.");
         msgs.Add("He became so powerful… the only thing he was afraid of was losing his power,");
         msgs.Add("which eventually, of course, he did.");
         msgs.Add("Unfortunately, he taught his apprentice everything he knew,");
         msgs.Add("then his apprentice killed him in his sleep.");
         msgs.Add("Ironic.");
         msgs.Add("He could save others from death, but not himself.");
         story.Messages = msgs;
         await _mongo.Insert("runescape", "stories", story);
     }
     catch (Exception ex)
     {
     }
 }
コード例 #28
0
        private StoryModel TopStoryFromCache()
        {
            StoryModel topStoryFromCache = null;

            _memoryCache.TryGetValue(topStoryKey, out topStoryFromCache);

            return(topStoryFromCache);
        }
コード例 #29
0
        /// <summary>
        /// Story list page
        /// </summary>
        /// <param name="dataManager">contains the data manger value</param>
        /// <param name="projectId">Project Id</param>
        /// <returns>return the grid list</returns>
        public JsonResult StoriesList([FromBody] DataManager dataManager, int projectId)
        {
            StoryModel story    = new StoryModel(this.iStoryBaseModel);
            var        list     = story.GetStoriesList(dataManager, projectId);
            var        settings = new JsonSerializerSettings();

            return(this.Json(new { result = list, count = story.TotalListCount }, settings));
        }
コード例 #30
0
ファイル: StoryController.cs プロジェクト: yeahrow/StoriesApp
        public async Task <IHttpActionResult> GetUserStories()
        {
            var stories = await _storyService.GetStoriesByUserName(User.Identity.Name);

            var storiesModel = stories.Select(s => StoryModel.MapFromEntity(s));

            return(Ok(storiesModel));
        }