Exemple #1
0
            public async Task <TicketDetailsDTO> Handle(RequestAssistanceCommand request, CancellationToken cancellationToken)
            {
                //steps
                //step 1 : create Assistance
                CIB_CustomerAssistance customerAssistance = new CIB_CustomerAssistance()
                {
                    AckOfUserForCall     = request.AckOfUserForCall,
                    AdditionalAssistData = request.AdditionalAssistData,
                    CreatedDate          = DateTime.Now,
                    CurrentLocation      = request.CurrentLocation,
                    IsActive             = true,
                    LoggedInDevice       = request.LoggedInDevice,
                    ModifiedDate         = DateTime.Now,
                    NumberForCallBack    = request.NumberForCallBack,
                    RedialAssist         = request.RedialAssist,
                    SystemKey            = request.SystemKey,
                    TypeOfAssistance     = request.TypeOfAssistance,
                    PlaceOfAssistance    = request.PlaceOfAssistance,
                    UserID = request.UserID
                };

                customerAssistance.CreatedDate = customerAssistance.ModifiedDate = DateTime.Now;
                customerAssistance.IsActive    = true;
                var customerAssistanceID = await _contextCA.AddAsync(customerAssistance);

                CIB_TicketDeatils ticketDeatils = null;

                //step 2 : create Ticket
                if (customerAssistanceID > 0)
                {
                    ticketDeatils = new CIB_TicketDeatils()
                    {
                        CreatedDate          = DateTime.Now,
                        CurrentLocation      = customerAssistance.CurrentLocation,
                        CustomerAssistanceID = customerAssistanceID,
                        IsActive             = true,
                        MobileNumber         = customerAssistance.NumberForCallBack,
                        Name              = customerAssistance.TypeOfAssistance,
                        TypeOfAssistance  = customerAssistance.TypeOfAssistance,
                        PlaceOfAssistance = customerAssistance.PlaceOfAssistance
                    };

                    var tktID = await _contextTKT.AddAsync(ticketDeatils);

                    ticketDeatils.ID = tktID;
                }

                return(_mapper.Map <TicketDetailsDTO>(ticketDeatils));
            }
            public async Task <long> Handle(RegisterCommand request, CancellationToken cancellationToken)
            {
                var entity = new CIB_UserLogin()
                {
                    CreatedDate      = DateTime.Now,
                    EmailAddress     = request.EmailAddress,
                    IsActive         = true,
                    LoggedInDevice   = request.LoggedInDevice,
                    Name             = request.Name,
                    Password         = request.Password,
                    RegisteredNumber = request.RegisteredNumber,
                    UserName         = request.UserName
                };

                return(await _context.AddAsync(entity));
            }