Exemple #1
0
        public static ValidationResult ValidateDocumentationTemplate(DocumentationTemplate documentationTemplate, ValidationContext validationContext)
        {
            if (documentationTemplate.Description == "noononononono")
            {
                return(new ValidationResult("Regla boba 1 para test en Tax"));
            }

            return(null);
        }
Exemple #2
0
        public async Task CreateAsync(DocumentationTemplate documentationTemplateToAdd)
        {
            Stopwatch timespan = Stopwatch.StartNew();

            try
            {
                db.DocumentationTemplates.Add(documentationTemplateToAdd);
                await db.SaveChangesAsync();

                timespan.Stop();
                log.TraceApi("SQL Database", "DocumentationTemplateRepository.CreateAsync", timespan.Elapsed, "documentationTemplateToAdd={0}", documentationTemplateToAdd);
            }
            catch (Exception e)
            {
                log.Error(e, "Error in DocumentationTemplateRepository.CreateAsync(documentationTemplateToAdd={0})", documentationTemplateToAdd);
                throw;
            }
        }
Exemple #3
0
        public async Task UpdateAsync(DocumentationTemplate documentationTemplateToSave)
        {
            Stopwatch timespan = Stopwatch.StartNew();

            try
            {
                db.Entry(documentationTemplateToSave).State = EntityState.Modified;
                await db.SaveChangesAsync();

                timespan.Stop();
                log.TraceApi("SQL Database", "DocumentationTemplateRepository.UpdateAsync", timespan.Elapsed, "documentationTemplateToSave={0}", documentationTemplateToSave);
            }
            catch (Exception e)
            {
                log.Error(e, "Error in DocumentationTemplateRepository.UpdateAsync(documentationTemplateToSave={0})", documentationTemplateToSave);
                throw;
            }
        }
Exemple #4
0
        public async Task <DocumentationTemplate> FindDocumentationTemplateByIDAsync(int documentationTemplateID)
        {
            DocumentationTemplate documentationTemplate = null;
            Stopwatch             timespan = Stopwatch.StartNew();

            try
            {
                documentationTemplate = await db.DocumentationTemplates.FindAsync(documentationTemplateID);

                timespan.Stop();
                log.TraceApi("SQL Database", "DocumentationTemplateRepository.FindDocumentationTemplateByIDAsync", timespan.Elapsed, "documentationTemplateID={0}", documentationTemplateID);
            }
            catch (Exception e)
            {
                log.Error(e, "Error in DocumentationTemplateRepository.FindDocumentationTemplateByIDAsync(documentationTemplateID={0})", documentationTemplateID);
                throw;
            }

            return(documentationTemplate);
        }
Exemple #5
0
        public async Task DeleteAsync(int documentationTemplateID)
        {
            DocumentationTemplate documentationTemplate = null;
            Stopwatch             timespan = Stopwatch.StartNew();

            try
            {
                DeleteDocumentationBusinessTypesTemplate(documentationTemplateID);

                documentationTemplate = await db.DocumentationTemplates.FindAsync(documentationTemplateID);

                db.DocumentationTemplates.Remove(documentationTemplate);
                db.SaveChanges();

                timespan.Stop();
                log.TraceApi("SQL Database", "DocumentationTemplateRepository.DeleteAsync", timespan.Elapsed, "documentationTemplateID={0}", documentationTemplateID);
            }
            catch (Exception e)
            {
                log.Error(e, "Error in DocumentationTemplateRepository.DeleteAsync(documentationTemplateID={0})", documentationTemplateID);
                throw;
            }
        }