Esempio n. 1
0
        public Database.Schema.Entity.DocumentType AddDocumentType(DocumentTypeManagement documentTypeManagement)
        {
            var documentType = db.DocumentTypes.Add(new Database.Schema.Entity.DocumentType
            {
                IsRequired  = documentTypeManagement.IsRequired,
                Name        = documentTypeManagement.Name,
                Description = documentTypeManagement.Description
            });

            db.SaveChanges();
            return(documentType);
        }
Esempio n. 2
0
        public IHttpActionResult EditDocumentType([FromBody] DocumentTypeManagement documentType, int id)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                return(Ok(_documentManagementService.EditDocumentType(documentType, id)));
            }
            catch (System.Exception e)
            {
                return(InternalServerError(e));
            }
        }
Esempio n. 3
0
 public DocumentTypeDto EditDocumentType(DocumentTypeManagement documentTypeManagement, int id)
 {
     db.DocumentTypes.Where(x => x.Id == id && !x.DelFlag).Update(x => new Database.Schema.Entity.DocumentType
     {
         IsRequired  = documentTypeManagement.IsRequired,
         Name        = documentTypeManagement.Name,
         Description = documentTypeManagement.Description
     });
     db.SaveChanges();
     return(new DocumentTypeDto
     {
         Id = id,
         IsRequired = documentTypeManagement.IsRequired,
         Name = documentTypeManagement.Name,
         Description = documentTypeManagement.Description
     });
 }