예제 #1
0
 public TicketLogDTO ConvertTicketLog(TicketLog log)
 {
     if (log != null)
     {
         TicketLogDTO dto = new TicketLogDTO(log);
         return(dto);
     }
     throw new ArgumentNullException();
 }
        public async Task <JsonResult> GetLastTicketLog(int?ticketId)
        {
            if (ticketId != null && ticketId > 0)
            {
                User curUser = await userManager.GetCurrentUser();

                List <TicketLog> curTicketLogs = await db.TicketLogs.Where(x => x.TicketId == ticketId && x.User.Id == curUser.Id).ToListAsync();

                if (curTicketLogs != null)
                {
                    TicketLog lastLog = curTicketLogs.SingleOrDefault(x => x.Time.Ticks == curTicketLogs.Max(z => z.Time.Ticks));
                    if (lastLog != null)
                    {
                        TicketLogDTO tempDto = dtoConverter.ConvertTicketLog(lastLog);
                        return(Json(tempDto, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }