Exemplo n.º 1
0
        public async Task <bool> Create(TicketStatus TicketStatus)
        {
            TicketStatusDAO TicketStatusDAO = new TicketStatusDAO();

            TicketStatusDAO.Id          = TicketStatus.Id;
            TicketStatusDAO.Name        = TicketStatus.Name;
            TicketStatusDAO.OrderNumber = TicketStatus.OrderNumber;
            TicketStatusDAO.ColorCode   = TicketStatus.ColorCode;
            TicketStatusDAO.StatusId    = TicketStatus.StatusId;
            TicketStatusDAO.Used        = TicketStatus.Used;
            TicketStatusDAO.CreatedAt   = StaticParams.DateTimeNow;
            TicketStatusDAO.UpdatedAt   = StaticParams.DateTimeNow;
            DataContext.TicketStatus.Add(TicketStatusDAO);
            await DataContext.SaveChangesAsync();

            TicketStatus.Id = TicketStatusDAO.Id;
            await SaveReference(TicketStatus);

            return(true);
        }
Exemplo n.º 2
0
        public async Task <bool> BulkMerge(List <TicketStatus> TicketStatuses)
        {
            List <TicketStatusDAO> TicketStatusDAOs = new List <TicketStatusDAO>();

            foreach (TicketStatus TicketStatus in TicketStatuses)
            {
                TicketStatusDAO TicketStatusDAO = new TicketStatusDAO();
                TicketStatusDAO.Id          = TicketStatus.Id;
                TicketStatusDAO.Name        = TicketStatus.Name;
                TicketStatusDAO.OrderNumber = TicketStatus.OrderNumber;
                TicketStatusDAO.ColorCode   = TicketStatus.ColorCode;
                TicketStatusDAO.StatusId    = TicketStatus.StatusId;
                TicketStatusDAO.Used        = TicketStatus.Used;
                TicketStatusDAO.CreatedAt   = StaticParams.DateTimeNow;
                TicketStatusDAO.UpdatedAt   = StaticParams.DateTimeNow;
                TicketStatusDAOs.Add(TicketStatusDAO);
            }
            await DataContext.BulkMergeAsync(TicketStatusDAOs);

            return(true);
        }
Exemplo n.º 3
0
        public async Task <bool> Update(TicketStatus TicketStatus)
        {
            TicketStatusDAO TicketStatusDAO = DataContext.TicketStatus.Where(x => x.Id == TicketStatus.Id).FirstOrDefault();

            if (TicketStatusDAO == null)
            {
                return(false);
            }
            TicketStatusDAO.Id          = TicketStatus.Id;
            TicketStatusDAO.Name        = TicketStatus.Name;
            TicketStatusDAO.OrderNumber = TicketStatus.OrderNumber;
            TicketStatusDAO.ColorCode   = TicketStatus.ColorCode;
            TicketStatusDAO.StatusId    = TicketStatus.StatusId;
            TicketStatusDAO.Used        = TicketStatus.Used;
            TicketStatusDAO.UpdatedAt   = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(TicketStatus);

            return(true);
        }