After the first part of the SoftUni homework for Entity Framework here, I have decided to make a small video with the next 4 problems.
Following the same logic, I have made a 30 minute YouTube video with the trial version of CamTasia. This is what I delivered:
The code is here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Globalization; using System.IO; namespace EF_Part2 { class Startup { static void Main() { SoftUniDB context = new SoftUniDB(); Gringotts contextG = new Gringotts(); string strResult = ""; var strComplete = @"C:\Users\gropc\Desktop\myModels.txt"; CultureInfo customCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; //Problem 11 //var lastProjects = context.Projects // .OrderByDescending(pro => pro.StartDate) // .Take(10) // .OrderBy(pro => pro.Name); //foreach (Project pro in lastProjects) //{ // strResult += $"{pro.Name} {pro.Description} {pro.StartDate} {pro.EndDate}\r\n"; //} //Problem 12 //var empInSpecificDepartment = context.Employees // .Where(e => e.Department.Name == "Engineering" || // e.Department.Name == "Tool Design" || // e.Department.Name == "Marketing" || // e.Department.Name == "Information Services"); //foreach (Employee emp in empInSpecificDepartment) //{ // decimal decSalary = emp.Salary; // decSalary *= 1.12M; // emp.Salary = decSalary; // strResult += $"{emp.FirstName} {emp.LastName} (${decSalary:F6})\r\n"; //} //context.SaveChanges(); //Problem 13 //var empWithSa = context.Employees // .Where(emp => emp.FirstName.Substring(0, 2).ToLower() == "sa"); //foreach (Employee emp in empWithSa) //{ // strResult += $"{emp.FirstName} {emp.LastName} - {emp.JobTitle} - (${emp.Salary})\r\n"; //} //Problem 14 //var wizWithDepo = contextG.WizzardDeposits // .Where(p => p.DepositGroup == "Troll Chest") // .OrderBy(p => p.FirstName) // .Select(p => p.FirstName.Substring(0, 1)) // .Distinct() // .ToList(); //foreach (var alpha in wizWithDepo) //{ // strResult += alpha + "\r\n"; //} StreamWriter file = new StreamWriter(strComplete, false); file.WriteLine(strResult); file.Close(); } } } |
Cheers 🙂