public List <Models.MViewModels.MviewPaidSalary> GetAll() { List <Models.MViewModels.MviewPaidSalary> PaidSalary = new List <Models.MViewModels.MviewPaidSalary>(); List <Models.MPaidSalary> Salary = new List <Models.MPaidSalary>(); Classes.CEmployees ce = new CEmployees(); Classes.CPaidSalary cp = new CPaidSalary(); Salary = cp.GetAll(); for (int i = 0; i < Salary.Count; i++) { Models.MViewModels.MviewPaidSalary mp = new Models.MViewModels.MviewPaidSalary(); string EmployeeName = ce.GetEmployeeNameById(Convert.ToInt32(Salary[i].EmployeeId)); mp.EmployeeName = EmployeeName; mp.Date = Salary[i].DatePaid; mp.Month = Salary[i].MonthPaid; mp.Amount = Salary[i].Paid; mp.WareHouseId = Salary[i].SalaryId; PaidSalary.Add(mp); } return(PaidSalary); }
public List <Models.MPaidSalary> GetAll() { List <Models.MPaidSalary> model = new List <Models.MPaidSalary>(); var query = from o in obj.PaidSalaries select o; foreach (var item in query) { Classes.CEmployees cp = new CEmployees(); string EmployeeName = string.Empty; EmployeeName = cp.GetEmployeeNameById(Convert.ToInt32(item.EmployeeId)); Models.MPaidSalary m = new Models.MPaidSalary(); m.id = Convert.ToString(item.id); m.EmployeeName = EmployeeName; m.EmployeeId = Convert.ToString(item.EmployeeId); m.SalaryId = Convert.ToString(item.SalaryId); m.MonthPaid = item.MonthPaid; m.Paid = item.Paid; m.DatePaid = item.DatePaid.ToString(); model.Add(m); } return(model); }