예제 #1
0
        public async Task <IActionResult> AddProjectCycleTaskComment([FromBody]
                                                                     [Bind("projectCycleTaskId", "user", "commentHeading", "comment")] AddProjectCycleTaskComment projectCycleTaskComment)
        {
            if (ModelState.IsValid)
            {
                ProjectCycleTaskComment pC = await _projectRepository.AddProjectCycleTaskCommentAsync(projectCycleTaskComment);

                if (pC != null)
                {
                    return(Ok(pC));
                }
                else
                {
                    return(Ok("error"));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
예제 #2
0
        public async Task <ProjectCycleTaskComment> AddProjectCycleTaskCommentAsync(AddProjectCycleTaskComment pC)
        {
            ProjectCycleTaskComment comment = new ProjectCycleTaskComment
            {
                CommentRegistered  = DateTime.Now,
                ByUser             = pC.user,
                Comment            = pC.comment,
                CommentHeading     = pC.commentHeading,
                ProjectCycleTaskId = await getProjectCycleTaskId(pC.projectCycleTaskId),
                Unique_IdString    = getGuid()
            };

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