Beispiel #1
0
        public async Task <IActionResult> AddProjectCycleComment([FromBody]
                                                                 [Bind("projectCycleId", "user", "commentHeading", "comment")] AddProjectCycleComment projectCycleComment)
        {
            if (ModelState.IsValid)
            {
                ProjectCycleComment pC = await _projectRepository.AddProjectCycleCommentAsync(projectCycleComment);

                if (pC != null)
                {
                    return(Ok(pC));
                }
                else
                {
                    return(Ok("error"));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Beispiel #2
0
        public async Task <ProjectCycleComment> AddProjectCycleCommentAsync(AddProjectCycleComment pC)
        {
            ProjectCycleComment comment = new ProjectCycleComment
            {
                CommentRegistered = DateTime.Now,
                ByUser            = pC.user,
                Comment           = pC.comment,
                CommentHeading    = pC.commentHeading,
                ProjectCycleId    = await getProjectCycleId(pC.projectCycleId),
                Unique_IdString   = getGuid()
            };

            _db.Add(comment);
            if (await _db.SaveChangesAsync() > 0)
            {
                return(comment);
            }
            else
            {
                return(null);
            }
        }