Пример #1
0
        public ClientDto AddClient(ClientDto newClient)
        {
            if (newClient != null)
            {
                ClientModel client = new ClientModel
                {
                    Name    = newClient.Name,
                    Phone   = newClient.Phone,
                    Email   = newClient.Email,
                    Address = newClient.Address,
                    Status  = newClient.Status,
                    Age     = newClient.Age
                };

                _context.clientModels.Add(client);
                _context.SaveChanges();
                newClient.IdClient = client.IdClient;

                return(newClient);
            }

            return(new ClientDto
            {
                MessageError = "Empy client"
            });
        }
        public ReservDetailDto AddDetail(ReservDetailDto reservDetail)
        {
            if (reservDetail != null)
            {
                ReservationDetail categoryEvent = new ReservationDetail
                {
                    IdFurniture  = reservDetail.IdFurniture,
                    IdReseration = reservDetail.IdReseration
                };

                _context.reservationDetails.Add(categoryEvent);
                _context.SaveChanges();
                reservDetail.IdDetail = categoryEvent.IdDetail;

                return(reservDetail);
            }

            return(new ReservDetailDto
            {
                MessageError = "Empy Event"
            });
        }
        public CategoryEventDto AddEvent(CategoryEventDto newCategory)
        {
            if (newCategory != null)
            {
                CategoryEventModel categoryEvent = new CategoryEventModel
                {
                    Description = newCategory.Description,
                    Price       = newCategory.Price
                };

                _context.eventModels.Add(categoryEvent);
                _context.SaveChanges();
                newCategory.IdEvent = categoryEvent.IdEvent;

                return(newCategory);
            }

            return(new CategoryEventDto
            {
                MessageError = "Empy Event"
            });
        }
        public ReservationDtocs AddReservation(ReservationDtocs reservation)
        {
            if (reservation != null)
            {
                ReservationModel reservationModel = new ReservationModel
                {
                    DateDue  = reservation.DateDue,
                    IdClient = reservation.IdClient,
                    IdEvent  = reservation.IdEvent
                };

                _context.reservationModels.Add(reservationModel);
                _context.SaveChanges();
                reservation.IdEvent = reservationModel.IdEvent;

                return(reservation);
            }

            return(new ReservationDtocs
            {
                MessageError = "Empy Event"
            });
        }
Пример #5
0
        public FurnitureDto AddFurniture(FurnitureDto newMobi)
        {
            if (newMobi != null)
            {
                FurnitureModel furniture = new FurnitureModel
                {
                    Description = newMobi.Description,
                    IsActive    = newMobi.IsActive,
                    Price       = newMobi.Price
                };

                _context.furnitureModels.Add(furniture);
                _context.SaveChanges();
                newMobi.IdFurniture = furniture.IdFurniture;

                return(newMobi);
            }

            return(new FurnitureDto
            {
                MessageError = "Empy client"
            });
        }