public async Task <IActionResult> CreateStory([FromRoute] Guid organizationId, [FromBody] CreateStoryInput input) { var story = await _storyService .CreateStory(_projectManager, input); return(Ok(story)); }
public async Task <IActionResult> Post(CreateStoryModel model) { try { return(Ok(await _storyService.CreateStory(model.WorldId, model.Title))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult CreateStory([FromBody] StoryDTO story) { try { _storyService.CreateStory(story); return(Created(nameof(GetStory), story)); } catch { return(BadRequest()); } }
public ActionResult CreateNewStory(StoryDetailsModel model) { if (ModelState.IsValid) { try { Story newStory = model.ToStory(); User user = _userService.GetUser(WebSecurity.CurrentUserId); newStory.User = user; if (model.Groups.Count > 0) { foreach (var groupModel in model.Groups) { if (groupModel.Id != 0) { Group group = _groupService.GetGroup(groupModel.Id); newStory.Groups.Add(group); } } } _storyService.CreateStory(newStory); _storyService.SaveStory(); return(RedirectToAction("MyStories", "Story")); } catch (Exception ex) { _logger.Error("Cannot create new story", ex); } } ViewBag.Groups = null; try { ViewBag.Groups = _groupService.GetGroups(WebSecurity.CurrentUserId); } catch (Exception ex) { _logger.Error(ex); } return(View(model)); }
public async Task <IHttpActionResult> CreateStory([FromBody] StoryPostModel model) { var story = await _storyService.CreateStory(new StoryEntity { Title = model.Title, Description = model.Description, Content = model.Content, UserId = 1, PostedOn = DateTime.Now, Groups = model.GroupIds.Select(g => new GroupEntity { Id = g }).ToList() }); if (story == null) { return(Json(new { success = false, message = "Something went wrong!" })); } return(Ok(new { success = true, message = "Successfully added!" })); }
public IActionResult CreateStory(string projectid, StoryModel model) { ViewBag.IsLogin = !string.IsNullOrEmpty(cache.GetString("user")); if (ViewBag.IsLogin) { ViewBag.User = JsonConvert.DeserializeObject <AccountModel>(cache.GetString("user")); } else { return(RedirectToAction("Login", "Account")); } var project = projectSvc.GetProject(projectid); var feature = featureSvc.GetFeatures(project._id).FirstOrDefault(it => it._id == model.Feature_id); if (ModelState.IsValid) { var isValid = ValidateClosingDate(true, project, feature, model); if (!isValid) { PrepareDataForDisplay(projectid); ViewBag.ProjectId = project._id; ViewBag.FeatureName = feature.Name; return(View(model)); } model.ClosingDate = model.ClosingDate.AddDays(1); if (!string.IsNullOrEmpty(model.BeAssignedMember_id)) { model.AssginByMember_id = model.CreateByMember_id; } storySvc.CreateStory(model); return(RedirectToAction("Index", "Project", new { projectid = projectid })); } PrepareDataForDisplay(projectid); ViewBag.ProjectId = project._id; ViewBag.FeatureName = feature.Name; return(View(model)); }
//[Authorize(Roles = "Admin, Vendor")] public async Task <IActionResult> CreateStory([FromBody] CreateStoryRequest request) { var result = await storyService.CreateStory(request); return(StatusCode((int)result.Code, result.Value)); }