public List <RestItemsListDto> GetUnSelectedRestItems(GetRestScheForEditInput input) { var restitemListDtos = new List <RestItemsListDto>(); try { var restitems = _RestItemRepository.GetAll() .Include(a => a.ItemsCategory) .Where(p => p.IsDeleted == false) .OrderBy(p => p.ItemDesc) .ToList(); restitemListDtos = ObjectMapper.Map <List <RestItemsListDto> >(restitems).OrderBy(a => a.Id).ToList(); foreach (var item in restitemListDtos) { var ItemCategoryDesc = _ItemsCategoryRepository.GetAll().Where(a => a.Id == item.ItemsCategoryId).SingleOrDefault(); item.ItemsCategoryDesc = ItemCategoryDesc.CategoryDesc; } return(new List <RestItemsListDto>(restitemListDtos)); } catch (Exception e) { } return(new List <RestItemsListDto>(restitemListDtos)); }
public List <RestItemsListDto> GetSelectedRestItems(GetRestScheForEditInput input) { List <RestItemsListDto> selectdrestitemListDtos = new List <RestItemsListDto>(); List <int> schitemid = new List <int>(); try { var restitems = _RestItemRepository.GetAll() .Where(p => p.IsDeleted == false) .OrderBy(p => p.ItemDesc) .ToList(); var restitemListDtos = ObjectMapper.Map <List <RestItemsListDto> >(restitems).OrderBy(a => a.Id).ToList(); var RestSchesItem = _RestScheduleItemRepository.GetAll().Where(a => a.RestSchedulesId == input.Id).ToList(); var RestScheItemListDtos = ObjectMapper.Map <List <RestSchesItemListDto> >(RestSchesItem).OrderBy(a => a.RestItemsId).ToList(); for (int i = 0; i < RestScheItemListDtos.Count(); i++) { schitemid.Add(RestScheItemListDtos[i].RestItemsId); } for (int n = 0; n < restitemListDtos.Count(); n++) { if (schitemid.Contains(restitemListDtos[n].Id) == true && selectdrestitemListDtos.Contains(restitemListDtos[n]) == false) { selectdrestitemListDtos.Add(restitemListDtos[n]); } } foreach (var item in selectdrestitemListDtos) { var ItemCategoryDesc = _ItemsCategoryRepository.GetAll().Where(a => a.Id == item.ItemsCategoryId).SingleOrDefault(); item.ItemsCategoryDesc = ItemCategoryDesc.CategoryDesc; } return(new List <RestItemsListDto>(selectdrestitemListDtos)); } catch (Exception e) { } return(new List <RestItemsListDto>(selectdrestitemListDtos)); }
public async Task <GetRestScheForEditOutput> GetRestScheForEdit(GetRestScheForEditInput input) { var RestSche = await _RestScheRepository.GetAsync(input.Id); return(ObjectMapper.Map <GetRestScheForEditOutput>(RestSche)); }