예제 #1
0
        public IEnumerable <DocumentUploadResponse> Get()
        {
            var docs = _unitOfWork.Documentfiles.GetAll();

            var d = docs.Select <DocumentFile, DocumentUploadResponse>((s) => {
                var t = new DocumentUploadResponse();
                t.ParseToViewModel(s);
                return(t);
            }).ToList();

            return(d);
        }
예제 #2
0
        public JsonResult Get(int id)
        {
            var resultSet = new DocumentUploadResponse();

            var foundDocument = _unitOfWork.Documentfiles.Get(id);

            if (foundDocument != null)
            {
                resultSet.ParseToViewModel(foundDocument);
            }
            else
            {
                resultSet.AddError(0, "Няма намерен Документ в системата");
            }

            return(new JsonResult(resultSet));
        }