//Json public JsonResult GetCollectors(int?id = -1) { if (id != -1) { var col = _collectorService.GetAll().Where(c => c.deleted != true && c.collector_branch_id == id) .Select(c => new { Id = c.collector_id, Code = c.collector_code, Name = c.collector_name, Phone = c.collector_phone, Father = c.collector_father_or_husband_name, Mother = c.collector_mother_name, AddressPerma = c.collector_parmanent_address, AddressPre = c.collector_present_address, Dob = String.Format("{0:dd/MM/yyyy}", c.collector_dob), BirthPlace = c.collector_birth_place, Image = c.collector_image, Employee = new { Id = c.hr_employee.emp_id, Name = c.hr_employee.emp_name }, Branch = new { Id = c.sys_branch.branch_id, Name = c.sys_branch.branch_name }, Profession = new { Id = c.hr_profession.profession_id, Name = c.hr_profession.profession_name } }); return(Json(col, JsonRequestBehavior.AllowGet)); } var cols = _collectorService.GetAll().Where(c => c.deleted != true) .Select(c => new { Id = c.collector_id, Code = c.collector_code, Name = c.collector_name, Phone = c.collector_phone, Father = c.collector_father_or_husband_name, Mother = c.collector_mother_name, AddressPerma = c.collector_parmanent_address, AddressPre = c.collector_present_address, Dob = String.Format("{0:dd/MM/yyyy}", c.collector_dob), BirthPlace = c.collector_birth_place, Image = c.collector_image, Employee = new { Id = c.hr_employee.emp_id, Name = c.hr_employee.emp_name }, Branch = new { Id = c.sys_branch.branch_id, Name = c.sys_branch.branch_name }, Profession = new { Id = c.hr_profession.profession_id, Name = c.hr_profession.profession_name } }); return(Json(cols, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(int?branchId = -1) { if (branchId == -1 || branchId == null) { branchId = _branchService.GetAll().FirstOrDefault().branch_id; } ViewBag.SP = _employeeService.GetAll().Where(e => e.emp_branch_id == branchId && e.deleted != true); ViewBag.Professions = _professionService.GetAll().OrderByDescending(p => p.profession_presidences); ViewBag.Cols = _collectorService.GetAll().Where(c => c.deleted != true && c.collector_branch_id == branchId); return(View()); }