Beispiel #1
0
        public object UpdateFileAction(FileActionInputDto input)
        {
            SqlHelper sqlHelper = new SqlHelper(connectionString);

            List <SqlParameter> fileActionParams = new List <SqlParameter>
            {
                new SqlParameter("file_id", input.fileId),
                new SqlParameter("action", input.action),
                new SqlParameter("action_start_date", DateTime.UtcNow),
                new SqlParameter("action_end_date", DateTime.UtcNow)
            };

            var query = $@"INSERT INTO[dbo].[file_action]
                           ([file_id]
                           ,[action]
                           ,[action_start_date]
                           ,[action_end_date])
                         VALUES
                           (@file_id
                           ,@action
                           ,@action_start_date
                           ,@action_end_date)";

            try
            {
                sqlHelper.VerifyConnection();

                sqlHelper.Insert(query, CommandType.Text, fileActionParams.ToArray());
            }
            catch (Exception ex)
            {
                sqlHelper.CloseConnection();
                return(Utils.Wrap(false));
            }

            return(Utils.Wrap(true));
        }
 public object FileAction(FileActionInputDto dto)
 {
     return(controller.UpdateFileAction(dto));
 }