Example #1
0
        public List <TicketAttachmentsAPI> GetByDiscussionId(int discussionId)
        {
            var attachments = _dBtsics.DiscussionAttachment.Where(q => q.TicketDiscussionId == discussionId).ToList();
            List <TicketAttachmentsAPI> attachmentList = new List <TicketAttachmentsAPI>();

            if (attachments.Count != 0)
            {
                foreach (var attachment in attachments)
                {
                    TicketAttachmentsAPI ticketAttachmentApi = new TicketAttachmentsAPI {
                        Name = attachment.Name
                    };

                    attachmentList.Add(ticketAttachmentApi);
                }
            }
            return(attachmentList);
        }
        public List <TicketAttachmentsAPI> GetByTicketId(int ticketId)
        {
            var attachments = _dBtsics.TicketAttachment.Where(q => q.TicketId == ticketId).ToList();
            List <TicketAttachmentsAPI> attachmentList = new List <TicketAttachmentsAPI>();

            if (attachments.Count != 0)
            {
                foreach (var attachment in attachments)
                {
                    TicketAttachmentsAPI ticketAttachmentApi = new TicketAttachmentsAPI
                    {
                        Id = attachment.TicketAttachmentId, Name = attachment.Name, Level = attachment.LevelUser
                    };

                    attachmentList.Add(ticketAttachmentApi);
                }
            }
            return(attachmentList);
        }