Exemple #1
0
        public MeetingActionComment InsertActionComment(MeetingActionComment meetingActionComment)
        {
            string sql = @"INSERT INTO [dbo].[meeting_action_comments]
                                ([meeting_action_id]
                                ,[comment_type]
                                ,[comments]
                                ,[created_by_id])
                                VALUES(
                                 @meetingactionid
                                ,@commenttype
                                ,@comments
                                ,@createdbyid);";

            DynamicParameters dpCmts = new DynamicParameters();

            dpCmts.Add("meetingactionid", meetingActionComment.MeetingActionId, DbType.Int32, ParameterDirection.Input);
            dpCmts.Add("commenttype", meetingActionComment.CommentType, DbType.String, ParameterDirection.Input);
            dpCmts.Add("comments", meetingActionComment.Comment, DbType.String, ParameterDirection.Input);
            dpCmts.Add("createdbyid", meetingActionComment.CreatedById, DbType.Int32, ParameterDirection.Input);

            using (IDbConnection conn = new SqlConnection(_connectionString))
            {
                conn.Open();
                using (var tran = conn.BeginTransaction())
                {
                    var insMeetingCmts = conn.Execute(sql, dpCmts, commandType: CommandType.Text, transaction: tran);
                    tran.Commit();
                }
            }
            return(meetingActionComment);
        }
Exemple #2
0
        public IHttpActionResult InsertActionComment(int id, MeetingActionComment meetingActionComment)
        {
            if (meetingActionComment == null || id < 0 || meetingActionComment.Comment == "")
            {
                return(BadRequest("Either action id or comment not found"));
            }

            var loggedInUser = HttpContext.Current.User as SecurityPrincipal;

            logger.Info($"Meeting action commented by {loggedInUser.ForeName}");

            meetingActionComment.MeetingActionId = id;
            meetingActionComment.CreatedById     = loggedInUser.Id;
            meetingActionComment.CreatedDate     = DateTime.Now;

            var result = _meetingActionService.InsertActionComment(meetingActionComment);

            return(Ok(result));
        }
 public MeetingActionComment InsertActionComment(MeetingActionComment meetingActionComment)
 {
     return(_meetingActionDataProvider.InsertActionComment(meetingActionComment));
 }