コード例 #1
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."
                }));
            }
        }