public void UpdateOperation(OperationDb operationDb)
 {
     using (var context = new QualificationDbContext())
     {
         context.Entry(operationDb).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public OperationDb AddOperation(OperationDb operationDb, Guid modelId)
 {
     using (var context = new QualificationDbContext())
     {
         var modelDb = context.Models.Include(m => m.Operations).FirstOrDefault(m => m.Id == modelId);
         modelDb.Operations.Add(operationDb);
         context.SaveChanges();
     }
     return(operationDb);
 }
Ejemplo n.º 3
0
        private OperationDb ToOperationDb(Operation operation)
        {
            var operationDb = new OperationDb();

            operationDb.Id        = operation.ID;
            operationDb.Name      = operation.Name;
            operationDb.Documents = new List <DocumentDb>();
            foreach (var document in operation.Documents)
            {
                var documentDb = ToDocumentDb(document);
                operationDb.Documents.Add(documentDb);
            }
            return(operationDb);
        }
Ejemplo n.º 4
0
        private Operation ToOperation(OperationDb operationDb)
        {
            var operation = new Operation();

            operation.ID        = operationDb.Id;
            operation.Name      = operationDb.Name;
            operation.Documents = new List <Document>();
            foreach (var documentDb in operationDb.Documents)
            {
                var document = ToDocument(documentDb);
                operation.Documents.Add(document);
            }
            return(operation);
        }