Exemplo n.º 1
0
 public ActionResult Create([Bind(Include = "Id,SprintName,Description,SprintRunning,StartDate,EndDate,ReleaseBacklogId,")] Sprint sprint)
 {
     if (ModelState.IsValid)
     {
         service.CreateSprint(sprint);
         //db.Sprints.Add(sprint);
         //db.SaveChanges();
         return(RedirectToAction("Details", new { Id = sprint.Id }));
     }
     return(View("Details", "ReleaseBacklog", new { Id = sprint.ReleaseBacklogId }));
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] SprintCreateVM sprint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var sprintId = _sprintService.CreateSprint(sprint);

            return(CreatedAtAction("Get", new { id = sprintId }, sprintId));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Post([FromBody] ProjectCreateViewModel project)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var projectId = _projectService.CreateProject(project, GetUserId());

            _sprintService.CreateSprint(new SprintCreateViewModel {
                ProjectId = projectId, Name = "Backlog"
            });
            return(CreatedAtAction("Get", new { id = projectId }, projectId));
        }
    public IActionResult CreateSprint([FromQuery(Name = "projectID")] int projectID, [FromBody] Object obj)
    {
        Sprint sprint    = JsonSerializer.Deserialize <Sprint>(obj.ToString());
        Sprint newSprint = _sprintService.CreateSprint(projectID, sprint.SprintName, sprint.SprintDateStart, sprint.SprintDateEnd);

        switch (newSprint)
        {
        case null:
            return(BadRequest(new
            {
                userMessage = "Operation was unsuccessful",
                errorCode = "Something went wrong"
            }));

        default:
            return(Created("", new
            {
                sprintID = newSprint.SprintID
            }));
        }
        ;
    }