コード例 #1
0
        public DocumentViewModel SetRecordinEdit(tblDocumentMaster tblDocument)
        {
            DocumentViewModel document = new DocumentViewModel();

            document.ID                   = tblDocument.DocumentID;
            document.DocumentName         = tblDocument.DocumentName;
            document.DocumentType         = tblDocument.DocumentType;
            document.ExpiryDateApplicable = (bool)tblDocument.ExpiryDateApplicable;
            document.ExpiryApplicableStr  = "No";
            if (document.ExpiryDateApplicable == true)
            {
                document.ExpiryApplicableStr = "Yes";
            }
            document.DocumentStatus = (short)tblDocument.Status;
            return(document);
        }
コード例 #2
0
        public void SaveUpdateRecord(DocumentViewModel document)
        {
            tblDocumentMaster tblDocument = new tblDocumentMaster();

            if (document.ID <= 0)
            {
                _context.tblDocumentMasters.Add(tblDocument);
            }
            else
            {
                tblDocument = _context.tblDocumentMasters.Where(x => x.DocumentID == document.ID).FirstOrDefault();
            }
            tblDocument.DocumentName         = document.DocumentName;
            tblDocument.DocumentType         = document.DocumentType;
            tblDocument.ExpiryDateApplicable = false;
            if (document.ExpiryApplicableStr == "Yes")
            {
                tblDocument.ExpiryDateApplicable = true;
            }
            tblDocument.Status = document.DocumentStatus;
            _context.SaveChanges();
        }
コード例 #3
0
        public DocumentViewModel SetDataOnEdit(tblDocumentMaster tbldoc)
        {
            var item = _documentRepository.SetRecordinEdit(tbldoc);

            return(item);
        }