示例#1
0
        public IActionResult ImprumutaCarteSchGen(ImprumutDTO imp)
        {
            string gen = Request.Form["carte.gen.Descriere"];

            Task <GenDTO> g1 = getGenDTO(gen);

            Task <List <CarteDTO> > list = getAcelasiGenAsync(g1.Result);

            return(View(list.Result));
        }
        public static Imprumut fromDtoToModel(ImprumutDTO dto)
        {
            Imprumut imprumut = new Imprumut();

            imprumut.imprumutId   = dto.imprumutId;
            imprumut.carteId      = dto.carteId;
            imprumut.cititorId    = dto.cititorId;
            imprumut.dataImprumut = dto.dataImprumut;
            imprumut.dataImprumut = dto.dataImprumut;
            imprumut.dataImprumut = dto.dataImprumut;

            return(imprumut);
        }
示例#3
0
        private async Task <ImprumutDTO> getImprumutAsync(CarteDTO carte, CititorDTO cititor)
        {
            DateTime d1 = DateTime.Now;
            DateTime d2 = DateTime.Now;

            d2.AddDays(14);
            Service1Client s   = new Service1Client();
            ImprumutDTO    imp = await s.getImprumutDTOAsync(d1, d2, carte, cititor);

            if (imp is null)
            {
                return(null);
            }
            return(imp);
        }
        public static ImprumutDTO fromModelToDto(Imprumut model)
        {
            if (model == null)
            {
                return(null);
            }
            ImprumutDTO imprumutDto = new ImprumutDTO();

            imprumutDto.imprumutId   = model.imprumutId;
            imprumutDto.carteId      = model.carteId;
            imprumutDto.cititorId    = model.cititorId;
            imprumutDto.dataImprumut = model.dataImprumut;
            imprumutDto.dataImprumut = model.dataImprumut;
            imprumutDto.dataImprumut = model.dataImprumut;

            return(imprumutDto);
        }
示例#5
0
        private void loanBookButton_Click(object sender, EventArgs e)
        {
            ReaderServiceClient readerService = new ReaderServiceClient();
            BookServiceClient   bookService   = new BookServiceClient();
            LoanServiceClient   loanService   = new LoanServiceClient();

            CititorDTO citior = readerService.GetReaderByEmail(emailInput.Text);
            CarteDTO   carte  = bookService.GetBookById(Int32.Parse(bookIdInput.Text));

            ImprumutDTO existingLoan = loanService.GetLoanForBookId(carte.carteId);

            if (existingLoan == null)
            {
                loanService.LoanBook(carte, citior, DateTime.Now, DateTime.Now.AddDays(30));
                this.Close();
            }
            else
            {
                bookIsNotAvailable.Text = "Cartea va fi disponibila in data de: " + existingLoan.dataScadenta;
                bookIsNotAvailable.Show();
            }
        }