Beispiel #1
0
        public async Task <IEnumerable <WeddingFavorites> > GetList(LeJourDBContext context)
        {
            var wfs = from wf in context.TbWeddingFavorites
                      select new WeddingFavorites
            {
                idWedding = wf.idWedding,
                idVendor  = wf.idVendor
            };

            return(await wfs.ToListAsync());
        }
Beispiel #2
0
        public async Task <IEnumerable <User> > GetList(LeJourDBContext context)
        {
            var users = from user in context.TbUser
                        select new User
            {
                idUser    = user.idUser,
                dtCreated = user.dtCreated
            };

            return(await users.ToListAsync());
        }
Beispiel #3
0
        public async Task <IEnumerable <Wedding> > GetList(LeJourDBContext context)
        {
            var weddings = from wedding in context.TbWedding
                           select new Wedding
            {
                idWedding = wedding.idWedding,
                idUser    = wedding.idUser,
                vlBudget  = wedding.vlBudget,
                dtWedding = wedding.dtWedding,
                nmGuests  = wedding.nmGuests,
                dsStyle   = wedding.dsStyle
            };

            return(await weddings.ToListAsync());
        }
Beispiel #4
0
        public async Task <IEnumerable <Appointment> > GetList(LeJourDBContext context)
        {
            var appointments = from appointment in context.TbAppointment
                               select new Appointment
            {
                idAppointment    = appointment.idAppointment,
                idWedding        = appointment.idWedding,
                idVendor         = appointment.idVendor,
                idStatus         = appointment.idStatus,
                dsCategoryVendor = appointment.dsCategoryVendor,
                dtAppointment    = appointment.dtAppointment,
            };

            return(await appointments.ToListAsync());
        }
Beispiel #5
0
        public async Task <IEnumerable <Invoice> > GetList(LeJourDBContext context)
        {
            var invoices = from invoice in context.TbInvoice
                           select new Invoice
            {
                idInvoice        = invoice.idInvoice,
                idWedding        = invoice.idWedding,
                idVendor         = invoice.idVendor,
                vlAmount         = invoice.vlAmount,
                vlAmountVendor   = invoice.vlAmountVendor,
                dtCreated        = invoice.dtCreated,
                dsAccepted       = invoice.dsAccepted,
                dsCategoryVendor = invoice.dsCategoryVendor
            };

            return(await invoices.ToListAsync());
        }
Beispiel #6
0
        public void Save(LeJourDBContext context, JsonElement body)
        {
            try
            {
                var wfModel = JsonSerializer.Deserialize <WeddingFavorites>(body.ToString());

                var wf = new TbWeddingFavorites
                {
                    idWedding = wfModel.idWedding,
                    idVendor  = wfModel.idVendor,
                };


                using (context)
                {
                    if (context.TbWeddingFavorites.Where(u => u.idWedding == wf.idWedding).Any())
                    {
                        context.TbWeddingFavorites.Update(wf);

                        if (context.TbWeddingFavorites.Where(a => a.idVendor == wf.idVendor).Any())
                        {
                            context.TbWeddingFavorites.Update(wf);
                        }
                        else
                        {
                            context.TbWeddingFavorites.Add(wf);
                        }
                    }
                    else
                    {
                        context.TbWeddingFavorites.Add(wf);
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                //Log exception
                throw;
            }
        }
Beispiel #7
0
        public void Save(LeJourDBContext context, JsonElement body)
        {
            try
            {
                var userModel = JsonSerializer.Deserialize <User>(body.ToString());

                var user = new TbUser
                {
                    idUser    = userModel.idUser,
                    dtCreated = userModel.dtCreated,
                };


                using (context)
                {
                    if (context.TbUser.Where(u => u.idUser == user.idUser).Any())
                    {
                        context.TbUser.Update(user);

                        if (context.TbUser.Where(a => a.idUser == user.idUser).Any())
                        {
                            context.TbUser.Update(user);
                        }
                        else
                        {
                            context.TbUser.Add(user);
                        }
                    }
                    else
                    {
                        context.TbUser.Add(user);
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                //Log exception
                throw;
            }
        }
Beispiel #8
0
        public void Save(LeJourDBContext context, JsonElement body)
        {
            try
            {
                var weddingModel = JsonSerializer.Deserialize <Wedding>(body.ToString());

                var wedding = new TbWedding
                {
                    idWedding = weddingModel.idWedding,
                    idUser    = weddingModel.idUser,
                    vlBudget  = weddingModel.vlBudget,
                    dtWedding = weddingModel.dtWedding,
                    nmGuests  = weddingModel.nmGuests,
                    dsStyle   = weddingModel.dsStyle
                };


                using (context)
                {
                    if (context.TbWedding.Where(u => u.idWedding == wedding.idWedding).Any())
                    {
                        context.TbWedding.Update(wedding);

                        if (context.TbWedding.Where(a => a.idUser == wedding.idUser).Any())
                        {
                            context.TbWedding.Update(wedding);
                        }

                        if (context.TbWedding.Where(a => a.vlBudget == wedding.vlBudget).Any())
                        {
                            context.TbWedding.Update(wedding);
                        }

                        if (context.TbWedding.Where(a => a.nmGuests == wedding.nmGuests).Any())
                        {
                            context.TbWedding.Update(wedding);
                        }

                        if (context.TbWedding.Where(a => a.dsStyle == wedding.dsStyle).Any())
                        {
                            context.TbWedding.Update(wedding);
                        }
                        else
                        {
                            context.TbWedding.Add(wedding);
                        }
                    }
                    else
                    {
                        context.TbWedding.Add(wedding);
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                //Log exception
                throw;
            }
        }
Beispiel #9
0
 internal Task Get(LeJourDBContext context, string idUser)
 {
     throw new NotImplementedException();
 }
Beispiel #10
0
        public void Save(LeJourDBContext context, JsonElement body)
        {
            try
            {
                var invoiceModel = JsonSerializer.Deserialize <Invoice>(body.ToString());

                var invoice = new TbInvoice
                {
                    idInvoice        = invoiceModel.idInvoice,
                    idWedding        = invoiceModel.idWedding,
                    idVendor         = invoiceModel.idVendor,
                    vlAmount         = invoiceModel.vlAmount,
                    vlAmountVendor   = invoiceModel.vlAmountVendor,
                    dtCreated        = invoiceModel.dtCreated,
                    dsAccepted       = invoiceModel.dsAccepted,
                    dsCategoryVendor = invoiceModel.dsCategoryVendor
                };


                using (context)
                {
                    if (context.TbInvoice.Where(u => u.idInvoice == invoice.idInvoice).Any())
                    {
                        context.TbInvoice.Update(invoice);

                        if (context.TbInvoice.Where(a => a.idWedding == invoice.idWedding).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.idVendor == invoice.idVendor).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.vlAmount == invoice.vlAmount).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.vlAmountVendor == invoice.vlAmountVendor).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.dtCreated == invoice.dtCreated).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.dsAccepted == invoice.dsAccepted).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        if (context.TbInvoice.Where(a => a.dsCategoryVendor == invoice.dsCategoryVendor).Any())
                        {
                            context.TbInvoice.Update(invoice);
                        }

                        context.TbInvoice.Add(invoice);
                    }
                    else
                    {
                        context.TbInvoice.Add(invoice);
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                //Log exception
                throw;
            }
        }
Beispiel #11
0
        public void Save(LeJourDBContext context, JsonElement body)
        {
            try
            {
                var appointmentModel = JsonSerializer.Deserialize <Appointment>(body.ToString());

                var appointment = new TbAppointment
                {
                    idAppointment    = appointmentModel.idAppointment,
                    idWedding        = appointmentModel.idWedding,
                    idVendor         = appointmentModel.idVendor,
                    idStatus         = appointmentModel.idStatus,
                    dsCategoryVendor = appointmentModel.dsCategoryVendor,
                    dtAppointment    = appointmentModel.dtAppointment
                };


                using (context)
                {
                    if (context.TbAppointment.Where(u => u.idAppointment == appointment.idAppointment).Any())
                    {
                        context.TbAppointment.Update(appointment);

                        if (context.TbAppointment.Where(a => a.idWedding == appointment.idWedding).Any())
                        {
                            context.TbAppointment.Update(appointment);
                        }

                        if (context.TbAppointment.Where(a => a.idVendor == appointment.idVendor).Any())
                        {
                            context.TbAppointment.Update(appointment);
                        }

                        if (context.TbAppointment.Where(a => a.idStatus == appointment.idStatus).Any())
                        {
                            context.TbAppointment.Update(appointment);
                        }

                        if (context.TbAppointment.Where(a => a.dsCategoryVendor == appointment.dsCategoryVendor).Any())
                        {
                            context.TbAppointment.Update(appointment);
                        }

                        if (context.TbAppointment.Where(a => a.dtAppointment == appointment.dtAppointment).Any())
                        {
                            context.TbAppointment.Update(appointment);
                        }
                        else
                        {
                            context.TbAppointment.Add(appointment);
                        }
                    }
                    else
                    {
                        context.TbAppointment.Add(appointment);
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                //Log exception
                throw;
            }
        }