示例#1
0
        public async Task <IActionResult> CreateDocument()
        {
            DocumentViewModel model = new DocumentViewModel
            {
                RequestBy     = userId,
                DocumentTypes = await typeRepository.GetAllDocumentType()
            };

            return(View(model));
        }
示例#2
0
        /// <summary>
        /// Method to get all the records from the DocumentType table
        /// </summary>
        /// <returns> List of records stored in table </returns>
        public TransactionDTO <List <DocumentTypeDTO> > GetAllDocumentType()
        {
            TransactionDTO <List <DocumentTypeDTO> > transaction = new TransactionDTO <List <DocumentTypeDTO> >();

            transaction.Data = new List <DocumentTypeDTO>();
            try
            {
                var getDocumentType = _documentTypeRepository.GetAllDocumentType();
                if (getDocumentType == null || getDocumentType.Count == 0)
                {
                    transaction.Status  = Common.Status.Failure;
                    transaction.Message = "No existen datos en la base de datos para los tipos de documentos.";

                    return(transaction);
                }
                foreach (var item in getDocumentType)
                {
                    DocumentTypeDTO documentTypeDTO = new DocumentTypeDTO(item.Id, item.Name, item.Code);
                    transaction.Data.Add(documentTypeDTO);
                }
            }
            catch (ArgumentException ex)
            {
                transaction.Status  = Common.Status.Failure;
                transaction.Message = ex.Message;
            }

            return(transaction);
        }
示例#3
0
        public ViewResult Index(string txtSearch)
        {
            IQueryable <DocumentTypeViewModel> q = DocumentTypeRepository.GetAllDocumentType()
                                                   .Select(item => new DocumentTypeViewModel
            {
                Id            = item.Id,
                CreatedUserId = item.CreatedUserId,
                //CreatedUserName = item.CreatedUserName,
                CreatedDate    = item.CreatedDate,
                ModifiedUserId = item.ModifiedUserId,
                //ModifiedUserName = item.ModifiedUserName,
                ModifiedDate = item.ModifiedDate,
                Name         = item.Name
            }).OrderByDescending(m => m.ModifiedDate);

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(q));
        }
示例#4
0
 public List <DocumentType> GetAllDocumentType()
 {
     return(_iDocumentTypeRepository.GetAllDocumentType());
 }