Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            using (SoftUniEntities softuniDbContextFirst = new SoftUniEntities())
            {
                using (SoftUniEntities softuniDbContextSecond = new SoftUniEntities())
                {
                    softuniDbContextSecond.Addresses.Find(3).AddressText = "Vasil Levski Str. 15";
                    softuniDbContextFirst.Addresses.Find(3).AddressText = "BulairStr 25";
                    softuniDbContextSecond.SaveChanges();
                    softuniDbContextFirst.SaveChanges();
                }
            }

            using (SoftUniEntities softuniDbContext = new SoftUniEntities())
            {
                string addressText = softuniDbContext.Addresses.Find(3).AddressText;
                Console.WriteLine(addressText);
            }
        }
Ejemplo n.º 2
0
 // Task 09.
 // Stored procedure usp_GetProjectsCountByEmployee has been created in SQL SERVER
 // EF Models were updated with the new stored procedure
 /// <summary>
 /// Method returns the total count of the projects for all found Employees with the given names.
 /// </summary>
 /// <param name="firstName">Employee FirstName</param>
 /// <param name="lastName">Employee LastName</param>
 /// <returns>Zero -  If no employee with the given names is found; Zero - If the given Employee has no projects</returns>
 public static int GetProjectsCountByEmployee(string firstName, string lastName)
 {
     using (SoftUniEntities softuniDbContext = new SoftUniEntities())
     {
         var projectsCount = softuniDbContext.usp_GetProjectsCountByEmployee(firstName, lastName).FirstOrDefault();
         return projectsCount.Value;
     }
 }