public ActionResult Detail(int id) { CropGermplasmCommittee viewModel = new CropGermplasmCommittee(); try { viewModel = _repository.Detail(id); return(View(viewModel)); } catch (Exception ex) { log.Error(ex.Message + ex.StackTrace); return(View("~/Views/Shared/Error.cshtml")); } }
public List <CropGermplasmCommittee> List() { CropGermplasmCommittee cropGermplasmCommittee = new CropGermplasmCommittee(); List <CropGermplasmCommittee> cropGermplasmCommitteeList = new List <CropGermplasmCommittee>(); var results = _dataContext.usp_ARS_CropGermplasmCommittees_Select(); if (results != null) { foreach (var result in results) { cropGermplasmCommittee = new CropGermplasmCommittee(); cropGermplasmCommittee.ID = result.crop_germplasm_committee_id; cropGermplasmCommittee.Name = result.crop_germplasm_committee_name; cropGermplasmCommittee.RosterURL = result.roster_url; cropGermplasmCommittee.Documents = GetDocuments(cropGermplasmCommittee.ID); cropGermplasmCommittee.CropDescriptors = GetCropDescriptors(cropGermplasmCommittee.ID); cropGermplasmCommitteeList.Add(cropGermplasmCommittee); } } return(cropGermplasmCommitteeList); }
public CropGermplasmCommittee Detail(int id) { CropGermplasmCommittee cropGermplasmCommittee = new CropGermplasmCommittee(); try { var result = _dataContext.usp_ARS_CropGermplasmCommittee_Select(id).FirstOrDefault(); if (result != null) { cropGermplasmCommittee = new CropGermplasmCommittee(); cropGermplasmCommittee.ID = result.crop_germplasm_committee_id; cropGermplasmCommittee.Name = result.crop_germplasm_committee_name; cropGermplasmCommittee.RosterURL = result.roster_url; cropGermplasmCommittee.Documents = GetDocuments(cropGermplasmCommittee.ID); cropGermplasmCommittee.CropDescriptors = GetCropDescriptors(cropGermplasmCommittee.ID); } } catch (Exception ex) { } return(cropGermplasmCommittee); }