public IssueTicket UpdateToIssueTicket(IssueTicket issueTicket)
        {
//            issueTicket.TargetStudentId = TargetStudentId;
            issueTicket.Status      = Status;
            issueTicket.LastUpdated = DateTime.Now;

            return(issueTicket);
        }
        public async Task <int> Handle(CreateIssueTicketCommand request, CancellationToken cancellationToken)
        {
            var entity = new IssueTicket
            {
                Title      = request.Title,
                CategoryId = request.CategoryId,
                Body       = request.Body,
            };

            _context.IssueTickets.Add(entity);

            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }
        public static IssueTicket EntityFromRequest(IssueTicket issueTicket, EditIssueTicketRequest request)
        {
            issueTicket.Type        = request.Type;
            issueTicket.EquipmentId = request.EquipmentId < 0 ? (int?)null : request.EquipmentId;
            issueTicket.LastUpdated = DateTime.Now.AddHours(7);
//            issueTicket.TargetStudentId = request.TargetStudentId < 0 ? (int?)null : request.TargetStudentId;
            issueTicket.Description = request.Description;
            //If image in request is null, don't change
            if (request.ImageUrl != null)
            {
                issueTicket.ImageUrl = request.ImageUrl;
            }

            return(issueTicket);
        }
예제 #4
0
        public string Insertissueticket(IssueTicket issueTicket)
        {
            string message = string.Empty;

            try
            {
                string updateddate = DateTime.UtcNow.ToShortDateString();
                issueTicket.UpdatedDate = Convert.ToDateTime(updateddate);
                issueTicketRepository.Insertissueticket(issueTicket);
                message = "Success";
            }
            catch (Exception ex)
            {
                message = "Success";
            }
            return(message);
        }
        public static GetIssueTicketResponse ResponseFromEntity(IssueTicket issueTicket, Student owner, Entities.ParamEntities.Param type, Equipment equipment, Entities.ParamEntities.Param equipmentType, Room room)
        {
            return(new GetIssueTicketResponse()
            {
                Status = issueTicket.Status,
                CreatedDate = issueTicket.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
                LastUpdated = issueTicket.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
                EquipmentId = equipment?.EquipmentId ?? -1,
                EquipmentCode = equipment?.Code ?? "null",
                EquipmentType = equipmentType?.ParamId ?? -1,
                EquipmentTypeName = equipmentType?.Name ?? "null",
                Description = issueTicket.Description,
                OwnerId = issueTicket.OwnerId,
                OwnerName = owner.Name,
                ImageUrl = issueTicket.ImageUrl,
//                TargetStudentId = issueTicket.TargetStudentId,
                Type = issueTicket.Type,
                TypeName = type.Name,
                IssueTicketId = issueTicket.IssueTicketId,
                RoomId = equipment?.RoomId ?? -1,
                RoomName = room?.Name ?? "null"
            });
        }
예제 #6
0
        public static GetIssueTicketDetailResponse ResponseFromEntity(IssueTicket issueTicket, Student owner, Entities.ParamEntities.Param type)
        {
            return(new GetIssueTicketDetailResponse()
            {
                IssueTicketId = issueTicket.IssueTicketId,
                Status = issueTicket.Status,
                CreatedDate = issueTicket.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
                LastUpdated = issueTicket.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
                EquipmentId = issueTicket.EquipmentId,
                Description = issueTicket.Description,
                ImageUrl = issueTicket.ImageUrl,

                Type = type.ParamId,
                TypeName = type.Name,

                OwnerId = owner.StudentId,
                OwnerEmail = owner.Email,
                OwnerName = owner.Name,

//                TargetStudentId = targetStudent?.StudentId,
//                TargetStudentEmail = targetStudent?.Email,
//                TargetStudentName = targetStudent?.Name
            });
        }
 public IssueTicket Insertissueticket(IssueTicket issueTicket)
 {
     _dbContext.IssueTicket.Add(issueTicket);
     _dbContext.SaveChanges();
     return(issueTicket);
 }