Ejemplo n.º 1
0
        public async Task <IActionResult> GetServiceInformationView(long serviceInformationId)
        {
            ServiceInformationModule invMod = new ServiceInformationModule();

            ServiceInformationView view = await invMod.ServiceInformation.Query().GetViewById(serviceInformationId);

            return(Ok(view));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteServiceInformation([FromBody] ServiceInformationView view)
        {
            ServiceInformationModule invMod             = new ServiceInformationModule();
            ServiceInformation       serviceInformation = await invMod.ServiceInformation.Query().MapToEntity(view);

            invMod.ServiceInformation.DeleteServiceInformation(serviceInformation).Apply();

            return(Ok(view));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> AddServiceInformation([FromBody] ServiceInformationView view)
        {
            ServiceInformationModule invMod = new ServiceInformationModule();

            NextNumber nnServiceInformation = await invMod.ServiceInformation.Query().GetNextNumber();

            view.ServiceInformationNumber = nnServiceInformation.NextNumberValue;

            ServiceInformation serviceInformation = await invMod.ServiceInformation.Query().MapToEntity(view);

            invMod.ServiceInformation.AddServiceInformation(serviceInformation).Apply();

            ServiceInformationView newView = await invMod.ServiceInformation.Query().GetViewByNumber(view.ServiceInformationNumber);


            return(Ok(newView));
        }
        public async Task TestAddUpdatDelete()
        {
            ServiceInformationInvoiceModule ServiceInformationInvoiceMod = new ServiceInformationInvoiceModule();
            InvoiceView invoice = await ServiceInformationInvoiceMod.Invoice.Query().GetViewById(5);

            ServiceInformationView serviceInformation = await ServiceInformationInvoiceMod.ServiceInformation.Query().GetViewById(3);

            ServiceInformationInvoiceView view = new ServiceInformationInvoiceView()
            {
                InvoiceId = invoice.InvoiceId,
                ServiceId = serviceInformation.ServiceId
            };
            NextNumber nnNextNumber = await ServiceInformationInvoiceMod.ServiceInformationInvoice.Query().GetNextNumber();

            view.ServiceInformationInvoiceNumber = nnNextNumber.NextNumberValue;

            ServiceInformationInvoice serviceInformationInvoice = await ServiceInformationInvoiceMod.ServiceInformationInvoice.Query().MapToEntity(view);

            ServiceInformationInvoiceMod.ServiceInformationInvoice.AddServiceInformationInvoice(serviceInformationInvoice).Apply();

            ServiceInformationInvoice newServiceInformationInvoice = await ServiceInformationInvoiceMod.ServiceInformationInvoice.Query().GetEntityByNumber(view.ServiceInformationInvoiceNumber);

            Assert.NotNull(newServiceInformationInvoice);

            newServiceInformationInvoice.InvoiceId = 8;

            ServiceInformationInvoiceMod.ServiceInformationInvoice.UpdateServiceInformationInvoice(newServiceInformationInvoice).Apply();

            ServiceInformationInvoiceView updateView = await ServiceInformationInvoiceMod.ServiceInformationInvoice.Query().GetViewById(newServiceInformationInvoice.ServiceInformationInvoiceId);

            if (updateView.InvoiceId == 8)
            {
                Assert.True(true);
            }

            ServiceInformationInvoiceMod.ServiceInformationInvoice.DeleteServiceInformationInvoice(newServiceInformationInvoice).Apply();
            ServiceInformationInvoice lookupServiceInformationInvoice = await ServiceInformationInvoiceMod.ServiceInformationInvoice.Query().GetEntityById(view.ServiceInformationInvoiceId);

            Assert.Null(lookupServiceInformationInvoice);
        }