Example #1
0
 public IActionResult GetMasrafsbyDavaId(int id)
 {
     try
     {
         var masrafs   = _masrafRepository.GetMasrafs(id);
         var masrafVMs = _mapper.Map <IQueryable <Masraf>, IList <MasrafViewModel> >(masrafs);
         return(Ok(masrafVMs));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #2
0
        public IActionResult GetList([FromQuery] ReportViewModel model)
        {
            var messages  = _messageRepository.GetMessagesByDavaId(model.DavaId).ToList();
            var documents = _documentRepository.GetDocuments().Where(d => d.DavaId == model.DavaId).ToList();
            var masrafs   = _masrafRepository.GetMasrafs().Where(d => d.DavaId == model.DavaId).ToList();

            if (model.DateDisabled)
            {
                messages.Where(m => m.Date <= model.EndDate && m.Date >= model.StartDate).ToList();
                documents.Where(m => m.Date <= model.EndDate && m.Date >= model.StartDate).ToList();
                masrafs.Where(m => m.Date <= model.EndDate && m.Date >= model.StartDate).ToList();
            }

            var reportListModel = new ReportListModel()
            {
                Masrafs = masrafs, Documents = documents, Messages = messages
            };
            var result = _mapper.Map <ReportListViewModel>(reportListModel);

            return(Ok(result));
        }