public Swarschik[] GetTop3SwarschiksBySalary() { return(SoftServDB.WorkersDB() .OfType <Swarschik>() .OrderByDescending(s => s.Salary) .Take(3) .ToArray()); }
public string GetRichestWorkerName() { return(SoftServDB.WorkersDB() .OrderByDescending(w => w.Salary).FirstOrDefault().Name); //return SoftServDB.WorkersDB() // .FirstOrDefault(w => w.Salary == SoftServDB.WorkersDB().Max(s => s.Salary)).Name; //return SoftServDB.WorkersDB().Select( w => w.Name.Where( s => s. ) ) }
public Worker[] GetTop5WorkersBySalary() { SoftServDB.WorkersDB() .OrderByDescending(s => s.Salary) .Take(5) .ToList(). ForEach(w => Debug.WriteLine($" {w.GetType().Name}")); return(SoftServDB.WorkersDB() .OrderByDescending(s => s.Salary) .Take(5) .ToArray()); }
public int GetWorkersQuantityByName(string name) { var workersCount = SoftServDB.WorkersDB().Where(w => w.Name == name).Count(); try { if (workersCount == 0) { throw new NameAbsenceException(name); } } catch (NameAbsenceException err) { var fault = new NameAbsenceFault(); fault.Result = false; fault.Message = err.Message; fault.Description = "Such name doesn't exits in the current context!!!"; var reason = new FaultReason(err.Message); throw new FaultException <NameAbsenceFault>(fault, reason); } return(workersCount); }
public decimal GetHighestSalary() { return(SoftServDB.WorkersDB().Max(w => w.Salary)); }
public int GetWorkersQuantity() { return(SoftServDB.WorkersDB().Count()); }