public static void EnsureSeeded(this DBContext context)
        {
            //User
            //UserPayment
            //UserTestAnswer
            //UserTestQuestion
            //Project
            //Event
            //ICOLink
            //WPTemplate
            //LandingTemplate
            //PresentationTemplate
            //SCTemplate
            //FuncBlock
            //Pricelist
            //UserTest
            //UserResult

            //if (!context.Users.Any())
            //{
            //    var types = JsonConvert.DeserializeObject<List<User>>(File.ReadAllText(@"db\seed" + Path.DirectorySeparatorChar + "users.json"));
            //    context.AddRange(types);
            //    context.SaveChanges();
            //}

            if (!context.FuncBlocks.Any())
            {
                var stati = JsonConvert.DeserializeObject <List <FuncBlock> >(File.ReadAllText(@"db\seed" + Path.DirectorySeparatorChar + "funcblocks.json"));
                context.AddRange(stati);
                context.SaveChanges();
            }
        }
Пример #2
0
        public void Initialize()
        {
            //Arrange
            var builder = new DbContextOptionsBuilder <DBContext>();

            builder.UseInMemoryDatabase("Idrug");
            var options = builder.Options;

            _context = new DBContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var usuarios = new List <Usuario>
            {
                new Usuario {
                    // IdUsuario = 1,
                    IdUsuario = 1
                },
                new Usuario {
                    //IdUsuario = 2,
                    IdUsuario = 1
                },
                new Usuario {
                    //IdUsuario = 3,
                    IdUsuario = 1,
                },
            };

            _context.AddRange(usuarios);
            _context.SaveChanges();

            _usuarioService = new UsuarioService(_context);
        }
Пример #3
0
        public void Initialize()
        {
            //Arrange
            var builder = new DbContextOptionsBuilder <DBContext>();

            builder.UseInMemoryDatabase("Idrug");
            var options = builder.Options;

            _context = new DBContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var farmacias = new List <Farmacia>
            {
                new Farmacia {
                    // IdFarmacia = 1,
                    IdFarmacia = 1
                },
                new Farmacia {
                    //IdFarmacia = 2,
                    IdFarmacia = 1
                },
                new Farmacia {
                    //IdFarmaciao = 3,
                    IdFarmacia = 1,
                },
            };

            _context.AddRange(farmacias);
            _context.SaveChanges();

            _farmaciaService = new FarmaciaService(_context);
        }
Пример #4
0
 public bool CreateInvoiceDT(List <InvoiceDTView> invoiceDTViews, int invoiceId)
 {
     try
     {
         List <InvoiceDetail> list = new List <InvoiceDetail>();
         invoiceDTViews.ForEach(s =>
         {
             list.Add(new InvoiceDetail
             {
                 Invoiceid = invoiceId,
                 Price     = s.Price,
                 Proid     = s.ProId,
                 Quantity  = s.Quantity
             });
         });
         db.AddRange(list);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(false);
     }
 }
Пример #5
0
 public void Add(Customer Customer)
 {
     using (var db = new DBContext())
     {
         db.AddRange(Customer);
         db.SaveChanges();
     }
 }
Пример #6
0
 void AddReadDataToDB()
 {
     using (DBContext db = new DBContext())
     {
         db.AddRange(_readDataList);
         db.SaveChanges();
     }
 }
Пример #7
0
 public void Add(OrderItem OrderItem)
 {
     using (var db = new DBContext())
     {
         db.AddRange(OrderItem);
         db.SaveChanges();
     }
 }
Пример #8
0
 public void Add(Product Product)
 {
     using (var db = new DBContext())
     {
         db.AddRange(Product);
         db.SaveChanges();
     }
 }
Пример #9
0
 public void Add(Category category)
 {
     using (var db = new DBContext())
     {
         category.IsDelete = false;
         db.AddRange(category);
         db.SaveChanges();
     }
 }
Пример #10
0
 public void Add(List <OrderItem> OrderItem)
 {
     if (OrderItem.Any())
     {
         using (var db = new DBContext())
         {
             db.AddRange(OrderItem);
             db.SaveChanges();
         }
     }
 }
Пример #11
0
        private static void SeedDb(DBContext context, ILogger <Startup> logger)
        {
            if (context.ChatRooms.Any())
            {
                logger.LogInformation("Database has already been seeded. Skipping it...");
                return;
            }

            logger.LogInformation("Saving entities...");
            var chatRooms = new List <ChatRoom>
            {
                new ChatRoom {
                    Name = "Chat Room 1", ActiveConnectionsLimit = 4
                },
                new ChatRoom {
                    Name = "Chat Room 2", ActiveConnectionsLimit = 6
                },
                new ChatRoom {
                    Name = "Chat Room 3", ActiveConnectionsLimit = 10
                }
            };

            var users = new List <User>
            {
                new User {
                    Name = "User A"
                },
                new User {
                    Name = "User B"
                },
                new User {
                    Name = "User C"
                }
            };

            context.AddRange(chatRooms);
            context.AddRange(users);
            context.SaveChanges();

            logger.LogInformation("Database has been seeded successfully.");
        }
Пример #12
0
        public static void InitDB()
        {
            int totalNumberOfUniqueTextParameters = 100;

            using (DBContext db = new DBContext())
            {
                var currentValues = db.UniqueTextParameters.ToList();
                db.RemoveRange(currentValues);

                db.AddRange(getListOfValues());
                db.SaveChanges();
            }

            List <UniqueTextParameter> getListOfValues()
            {
                List <UniqueTextParameter> values = new List <UniqueTextParameter>();
                int    index = 33;
                char   charValue;
                string stringValue;

                do
                {
                    charValue   = Convert.ToChar(index);
                    stringValue = charValue.ToString();

                    if (stringValue.Length == 1 && !values.Any(v => v.Text == stringValue))
                    {
                        values.Add(new UniqueTextParameter()
                        {
                            Text = stringValue
                        });
                    }

                    index = getNextIndex(index);
                } while (values.Count < totalNumberOfUniqueTextParameters);

                return(values);
            }

            int getNextIndex(int currentIndex)
            {
                currentIndex++;
                if (currentIndex >= 127 && currentIndex <= 160)
                {
                    return(161);
                }
                else
                {
                    return(currentIndex);
                }
            }
        }
Пример #13
0
 public ActionResult <string> AddTag(List <Tag> Hashtag)
 {
     try
     {
         dBContext.AddRange(Hashtag);
         dBContext.SaveChanges();
         return(Ok(Hashtag));
     }
     catch (Exception ex)
     {
         return(Ok(ex.Message));
     }
     // return Ok(Hashtag);
 }
Пример #14
0
        public void Initialize()
        {
            //Arrange
            var builder = new DbContextOptionsBuilder <DBContext>();

            builder.UseInMemoryDatabase("Biblioteca");
            var options = builder.Options;

            _context = new DBContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var medicamentosDisponiveis = new List <Medicamentodisponivel>
            {
                new Medicamentodisponivel {
                    // IdDisponibilizacaoMedicamento = 1,
                    IdMedicamento = 1,
                    IdFarmacia    = 1,
                    DataInicioDisponibilizacao = DateTime.Parse("2021-07-01"),
                    DataFimDisponibilizacao    = DateTime.Parse("2021-08-01"),
                    QuantidadeDisponibilizacao = 10,
                    Lote                 = "126",
                    Quantidade           = "10",
                    ValidadeMes          = "agosto",
                    ValidadeAno          = 2021,
                    StatusMedicamento    = "Disponível",
                    DataVencimento       = DateTime.Parse("2021-08-10"),
                    QuantidadeReservada  = 0,
                    QuantidadeEntregue   = 0,
                    QuantidadeDisponivel = 0
                },
                new Medicamentodisponivel {
                    //IdDisponibilizacaoMedicamento = 2,
                    IdMedicamento = 1,
                    IdFarmacia    = 1,
                    DataInicioDisponibilizacao = DateTime.Parse("2021-07-01"),
                    DataFimDisponibilizacao    = DateTime.Parse("2021-08-01"),
                    QuantidadeDisponibilizacao = 10,
                    Lote                 = "126",
                    Quantidade           = "10",
                    ValidadeMes          = "agosto",
                    ValidadeAno          = 2021,
                    StatusMedicamento    = "Disponível",
                    DataVencimento       = DateTime.Parse("2021-08-10"),
                    QuantidadeReservada  = 0,
                    QuantidadeEntregue   = 0,
                    QuantidadeDisponivel = 0
                },
                new Medicamentodisponivel {
                    //IdDisponibilizacaoMedicamento = 3,
                    IdMedicamento = 1,
                    IdFarmacia    = 1,
                    DataInicioDisponibilizacao = DateTime.Parse("2021-07-01"),
                    DataFimDisponibilizacao    = DateTime.Parse("2021-08-01"),
                    QuantidadeDisponibilizacao = 10,
                    Lote                 = "126",
                    Quantidade           = "10",
                    ValidadeMes          = "agosto",
                    ValidadeAno          = 2021,
                    StatusMedicamento    = "Disponível",
                    DataVencimento       = DateTime.Parse("2021-08-10"),
                    QuantidadeReservada  = 0,
                    QuantidadeEntregue   = 0,
                    QuantidadeDisponivel = 0
                },
            };

            _context.AddRange(medicamentosDisponiveis);
            _context.SaveChanges();

            _disponibilizarMedicamentoService = new DisponibilizarMedicamentoService(_context);
        }
Пример #15
0
 public void AddMultiple(List <T> entities)
 {
     _context.AddRange(entities);
 }
        public bool MakeDoctorsWorktime(DoctorsViewModel doctors, int?id)
        {
            // Получение id только что сохранённого доктора.
            int idD;

            if (id == null)
            {
                idD = _context.Doctors.FirstOrDefault(d => d.DoctorsExistedFlag && d.DoctorsName == doctors.Doctor.DoctorsName && d.DoctorsPhoneNumber == doctors.Doctor.DoctorsPhoneNumber && d.ClinicalDepartmentId == doctors.Doctor.ClinicalDepartmentId && d.DoctorsSpecialization == doctors.Doctor.DoctorsSpecialization).DoctorsId;
            }
            else
            {
                idD = (int)id;
            }

            DateTime startDate = Convert.ToDateTime(doctors.doctorsStartDate);
            DateTime stopDate  = Convert.ToDateTime(doctors.doctorsStopDate);
            var      datesList = new List <DateTime>();
            // Количество периодов приёма пациентов в рабочий день. Если шаг по 20 минут при рабочем дне с 09:00 до 18:00, то в час возможно 3 приёма, а за 9 часов, соответственно, возможно 26 приёмов.
            int minutePeriodsPerDay = 26;

            if (Convert.ToDateTime(doctors.doctorsStopDate) >= Convert.ToDateTime(doctors.doctorsStartDate))
            {
                double daysToAdd = 1;
                while (startDate <= stopDate)
                {
                    if (startDate.DayOfWeek != DayOfWeek.Saturday && startDate.DayOfWeek != DayOfWeek.Sunday)
                    {
                        datesList.Add(startDate);
                    }
                    startDate = startDate.AddDays(daysToAdd);
                }
                List <DoctorsAppointments> doctorsAppointmentsList = new List <DoctorsAppointments>();

                // Формирование разбиения рабочего дня на отрезки по 20 минут.
                // Начало рабочего дня
                string          startTime = "09:00";
                DateTime        start     = Convert.ToDateTime(startTime);
                List <DateTime> timing    = new List <DateTime>();
                timing.Add(start);
                List <string> minutePeriodsPerDayArray = new List <string>();
                // Если рабочий день с 09:00 по 18:00, то в нём 26 отрезков по 20 минут.
                for (int i = 0; i <= 26; i++)
                {
                    minutePeriodsPerDayArray.Add(timing[i].ToString("HH:mm"));
                    if (i == 26)
                    {
                        break;
                    }
                    timing.Add(timing[i].AddMinutes(20));
                }

                // Список отрезков времени работы доктора, в которые уже записаны пациенты.
                List <DoctorsAppointments> alreadyExistedDoctorsAppointmentsListWithAppointedCustomers = _context.DoctorsAppointments.Where(d => d.DoctorAppointmentsExistedFlag && d.DoctorsId == idD && d.CustomerId != null).ToList();

                // Создаётся график приёмов. Приём (отрезок времени в 20 минут на него) считается свободным, если в данном DoctorsAppointments (приёме) CustomerId равен null, то есть никакой пациент ещё не записался на этот отрезок времени.
                foreach (var date in datesList)
                {
                    for (int i = 0; i < minutePeriodsPerDay; i++)
                    {
                        // Если на текущий отрезок времени уже был записан пациент, и этот отрезок времени попадает в рамки создаваемого графика, то внести id данного пациента в список изменения или добавления графика доктора, а если нет, то просто создать данный отрезок времени без какого-либо записанного на него пациента.
                        if (alreadyExistedDoctorsAppointmentsListWithAppointedCustomers.Any(d => d.DoctorAppointmentsDate == date.ToShortDateString() && d.DoctorAppointmentsTime == minutePeriodsPerDayArray[i]))
                        {
                            doctorsAppointmentsList.Add(new DoctorsAppointments
                            {
                                DoctorsId                     = idD,
                                CustomerId                    = alreadyExistedDoctorsAppointmentsListWithAppointedCustomers.FirstOrDefault(d => d.DoctorAppointmentsDate == date.ToShortDateString() && d.DoctorAppointmentsTime == minutePeriodsPerDayArray[i]).CustomerId,
                                DoctorAppointmentsDate        = date.ToString("yyyy-MM-dd"),
                                DoctorAppointmentsTime        = minutePeriodsPerDayArray[i],
                                DoctorAppointmentsExistedFlag = true
                            });
                        }
                        else
                        {
                            doctorsAppointmentsList.Add(new DoctorsAppointments
                            {
                                DoctorsId = idD,
                                DoctorAppointmentsDate        = date.ToString("yyyy-MM-dd"),
                                DoctorAppointmentsTime        = minutePeriodsPerDayArray[i],
                                DoctorAppointmentsExistedFlag = true
                            });
                        }
                    }
                }

                // Если график доктора уже существовал, то удалить старый график и внести новый (но с сохранением записей пациентов, запись которых попадает по дате в рамки нового графика). Если график доктора ещё не был создан, то просто добавить его.
                if (doctors.Doctor.DoctorsAppointments != doctorsAppointmentsList && doctors.Doctor.DoctorsAppointments != null)
                {
                    _context.DoctorsAppointments.RemoveRange(doctors.Doctor.DoctorsAppointments);
                    _context.AddRange(doctorsAppointmentsList);
                    _context.SaveChanges();
                }
                if (doctors.Doctor.DoctorsAppointments == null)
                {
                    _context.AddRange(doctorsAppointmentsList);
                    _context.SaveChanges();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #17
0
    public static void Seed(DBContext context)
    {
        var mlbApi = new BaseballApi();

        if (!context.Team.Any())
        {
            Console.WriteLine("Seeding Teams, Venues, Leagues, Divisions and Sport tables ...");
            JsonValue teams = mlbApi.GetMLBTeams();
            Dictionary <int, Team> teamList = new Dictionary <int, Team>();

            foreach (JsonValue item in teams)
            {
                var team = new Team()
                {
                    Id    = item["id"],
                    Name  = item["name"],
                    Venue = new Venue()
                    {
                        Id   = item["venue"]["id"],
                        Name = item["venue"]["name"]
                    },
                    TeamCode        = item["teamCode"],
                    FileCode        = item["fileCode"],
                    Abbreviation    = item["abbreviation"],
                    TeamName        = item["teamName"],
                    LocationName    = item["locationName"],
                    FirstYearOfPlay = item["firstYearOfPlay"],
                    League          = new League()
                    {
                        Id             = item["league"]["id"],
                        Name           = item["league"]["name"],
                        Abbreviation   = "",
                        IsSpringLeague = false
                    },
                    Division = new Division()
                    {
                        Id   = item["division"]["id"],
                        Name = item["division"]["name"]
                    },
                    Sport = new Sport()
                    {
                        Id   = item["sport"]["id"],
                        Name = item["sport"]["name"]
                    },
                    ShortName    = item["shortName"],
                    SpringLeague = new League()
                    {
                        Id             = item["springLeague"]["id"],
                        Name           = item["springLeague"]["name"],
                        Abbreviation   = item["springLeague"]["abbreviation"],
                        IsSpringLeague = true
                    },
                    AllStarStatus = item["allStarStatus"],
                    Active        = item["active"]
                };
                if (!teamList.ContainsKey(item["id"]))
                {
                    teamList.Add(item["id"], team);
                }
            }

            context.AddRange(teamList.Values);
            context.SaveChanges();
        }

        if (!context.Roster.Any())
        {
            Console.WriteLine("Seeding Roster and Position tables ...");
            var teams = context.Team.ToList();
            Dictionary <int, Roster> rosterList = new Dictionary <int, Roster>();

            foreach (var t in teams)
            {
                var teamRoster = mlbApi.GetTeamRosterStats(t.Id);

                foreach (JsonValue person in teamRoster)
                {
                    var rosterPerson = new Roster()
                    {
                        PersonId     = person["person"]["id"],
                        TeamId       = person["parentTeamId"],
                        FullName     = person["person"]["fullName"],
                        JerseyNumber = person["jerseyNumber"],
                        BirthDate    = person["person"]["birthDate"],
                        BirthCountry = person["person"]["birthCountry"],
                        Height       = person["person"]["height"],
                        Weight       = person["person"]["weight"],
                        Position     = new Position()
                        {
                            Code         = person["position"]["code"],
                            Name         = person["position"]["name"],
                            Type         = person["position"]["type"],
                            Abbreviation = person["position"]["abbreviation"]
                        },
                        Status    = person["status"]["description"],
                        Season    = "",
                        StatGroup = ""
                    };

                    if (person["person"].ContainsKey("stats"))
                    {
                        var rosterStats = person["person"]["stats"][0]["splits"];

                        foreach (JsonValue stat in rosterStats)
                        {
                            if (stat.ContainsKey("team") && stat["team"]["id"].ToString() == person["parentTeamId"].ToString())
                            {
                                rosterPerson.Season    = stat["season"];
                                rosterPerson.StatGroup = person["person"]["stats"][0]["group"]["displayName"];
                            }
                        }
                    }
                    if (!rosterList.ContainsKey(person["person"]["id"]))
                    {
                        rosterList.Add(person["person"]["id"], rosterPerson);
                    }
                }
            }

            context.AddRange(rosterList.Values);
            context.SaveChanges();
        }

        if (!context.Person.Any())
        {
            Console.WriteLine("Seeding Players and stats table ...");
            var players = context.Roster.ToList();
            Dictionary <int, Person> personList = new Dictionary <int, Person>();
            List <Stat> statList = new List <Stat>();

            foreach (var p in players)
            {
                var people = mlbApi.GetPersonStats(p.PersonId)[0];

                var person = new Person()
                {
                    Id           = people["id"],
                    FullName     = people["fullName"],
                    FirstName    = people["firstName"],
                    LastName     = people["lastName"],
                    BirthDate    = people["birthDate"],
                    Age          = people["currentAge"],
                    BirthCity    = people["birthCity"],
                    BirthCountry = people["birthCountry"],
                    Height       = people["height"],
                    Weight       = people["weight"],
                    Active       = people["active"],
                    Position     = new Position()
                    {
                        Code         = people["primaryPosition"]["code"],
                        Name         = people["primaryPosition"]["name"],
                        Type         = people["primaryPosition"]["type"],
                        Abbreviation = people["primaryPosition"]["abbreviation"]
                    },
                    Gender             = people["gender"],
                    IsPlayer           = people["isPlayer"],
                    IsVerified         = people["isVerified"],
                    BatSide            = people["batSide"]["description"],
                    PitchHand          = people["pitchHand"]["description"],
                    PrimaryNumber      = 0,
                    BirthStateProvince = null,
                    MiddleName         = "---",
                    NickName           = null,
                    DraftYear          = "---",
                    MLBDebutDate       = null
                };

                if (people.ContainsKey("primaryNumber"))
                {
                    person.PrimaryNumber = people["primaryNumber"];
                }

                if (people.ContainsKey("birthStateProvince"))
                {
                    person.BirthStateProvince = people["birthStateProvince"];
                }

                if (people.ContainsKey("middleName"))
                {
                    person.MiddleName = people["middleName"];
                }

                if (people.ContainsKey("nickName"))
                {
                    person.NickName = people["nickName"];
                }

                if (people.ContainsKey("draftYear"))
                {
                    person.DraftYear = people["draftYear"].ToString();
                }

                if (people.ContainsKey("mlbDebutDate"))
                {
                    person.MLBDebutDate = people["mlbDebutDate"];
                }

                if (!personList.ContainsKey(people["id"]))
                {
                    personList.Add(people["id"], person);
                }


                if (people.ContainsKey("stats"))
                {
                    foreach (JsonValue stat in people["stats"])
                    {
                        foreach (JsonValue split in stat["splits"])
                        {
                            var playerStat = new Stat()
                            {
                                PersonId     = people["id"],
                                TeamId       = 0,
                                StatGroup    = stat["group"]["displayName"],
                                Season       = split["season"],
                                PositionCode = ""
                            };

                            if (split.ContainsKey("team"))
                            {
                                playerStat.TeamId = split["team"]["id"];
                                playerStat.Name   = playerStat.Season + " - " + split["team"]["name"];
                            }

                            if (playerStat.StatGroup == "fielding")
                            {
                                playerStat.PositionCode = split["stat"]["position"]["code"];
                            }

                            // "Overall" stats
                            if (playerStat.StatGroup == "hitting" || playerStat.StatGroup == "pitching")
                            {
                                playerStat.GamesPlayed          = split["stat"]["gamesPlayed"];
                                playerStat.Runs                 = split["stat"]["runs"];
                                playerStat.HomeRuns             = split["stat"]["homeRuns"];
                                playerStat.StrikeOuts           = split["stat"]["strikeOuts"];
                                playerStat.Hits                 = split["stat"]["hits"];
                                playerStat.AVG                  = split["stat"]["avg"];
                                playerStat.OBP                  = split["stat"]["obp"];
                                playerStat.SLG                  = split["stat"]["slg"];
                                playerStat.OPS                  = split["stat"]["ops"];
                                playerStat.StolenBasePercentage = split["stat"]["stolenBasePercentage"];
                            }
                            else  // Only Fielding
                            {
                                playerStat.Name += " - " + split["stat"]["position"]["name"]
                                                   + " (" + split["stat"]["position"]["abbreviation"] + ")";
                                playerStat.GamesPlayed  = split["stat"]["games"];
                                playerStat.GamesStarted = split["stat"]["gamesStarted"];
                                playerStat.Assists      = split["stat"]["assists"];
                                playerStat.PutOuts      = split["stat"]["putOuts"];
                                playerStat.Errors       = split["stat"]["errors"];
                                playerStat.Chances      = split["stat"]["chances"];
                                playerStat.Fielding     = split["stat"]["fielding"];

                                if (playerStat.Fielding == "")
                                {
                                    playerStat.Fielding = "---";
                                }
                            }

                            // Only hitting stats
                            if (playerStat.StatGroup == "hitting")
                            {
                                playerStat.Doubles = split["stat"]["doubles"];
                                playerStat.Triples = split["stat"]["triples"];
                                playerStat.RBI     = split["stat"]["rbi"];
                                playerStat.BABIP   = split["stat"]["babip"];
                            }

                            // Only Pitching stats
                            if (playerStat.StatGroup == "pitching")
                            {
                                playerStat.GamesStarted       = split["stat"]["gamesStarted"];
                                playerStat.ERA                = split["stat"]["era"];
                                playerStat.Wins               = split["stat"]["wins"];
                                playerStat.Losses             = split["stat"]["losses"];
                                playerStat.Whip               = split["stat"]["whip"];
                                playerStat.StrikePercentage   = split["stat"]["strikePercentage"];
                                playerStat.WinPercentage      = split["stat"]["winPercentage"];
                                playerStat.GamesFinished      = split["stat"]["gamesFinished"];
                                playerStat.StrikeOutWalkRatio = split["stat"]["strikeoutWalkRatio"];
                            }

                            var seasonYear = Int32.Parse(playerStat.Season);
                            if (playerStat.TeamId != 0 && seasonYear >= DateTime.Now.Year - 2)
                            {
                                statList.Add(playerStat);
                            }
                        }
                    }
                }
            }

            context.AddRange(personList.Values);
            context.AddRange(statList);
            context.SaveChanges();
        }
    }
Пример #18
0
 public virtual IEnumerable <TEntity> Inserir(IEnumerable <TEntity> entities)
 {
     _dbContexto.AddRange(entities);
     _dbContexto.SaveChanges();
     return(entities);
 }