public async Task <PrintingShop> PostPrintingShopDetailes(PrintingShop NewPrintirDetailes)
        {
            await applicationDbContext.printingShops.AddAsync(NewPrintirDetailes);

            await applicationDbContext.SaveChangesAsync();

            return(NewPrintirDetailes);
        }
        public PrintingShopApiMode.Response GetPrintingShopDetailes(Guid PrinterId)
        {
            PrintingShop printingShop = applicationDbContext.printingShops.Find(PrinterId);

            PrintingShopApiMode.Response rsulte = new PrintingShopApiMode.Response
            {
                prenterName      = printingShop.prenterName,
                ownerId          = printingShop.ownerId,
                isService        = printingShop.isService,
                isCourseMaterial = printingShop.isCourseMaterial,
                prentingShopId   = printingShop.prentingShopId.ToString()
            };

            return(rsulte);
        }
Exemplo n.º 3
0
        public async Task <ActionResult <ApiRespnse <PrintingShopApiMode.Response> > > PostAsync(PrintingShopApiMode.Request request)
        {
            var response   = new ApiRespnse <PrintingShopApiMode.Response>();
            var NewPrinter = new PrintingShop()
            {
                prentingShopId   = Guid.NewGuid(),
                prenterName      = request.prenterName,
                ownerId          = request.ownerId,
                isCourseMaterial = request.isCourseMaterial,
                isService        = request.isService
            };
            var resulte = await _printingShops.PostPrintingShopDetailes(NewPrinter);

            response.Data = new PrintingShopApiMode.Response()
            {
                prentingShopId   = resulte.prentingShopId.ToString(),
                prenterName      = resulte.prenterName,
                isCourseMaterial = resulte.isCourseMaterial,
                isService        = resulte.isService,
                ownerId          = resulte.ownerId
            };

            return(Ok(response));
        }