Exemple #1
0
        public ActionResult CreateOperation(Models.Operations.OperationInsert model)
        {
            Models.DB.Operation dbOperation = new Models.DB.Operation();
            Int32 operationId;

            dbOperation.OperationNumber = model.OperationNumber;
            dbOperation.SequenceNumber  = model.SequenceNumber;
            dbOperation.OperationStart  = model.Start;
            dbOperation.OperationEnd    = model.End;
            dbOperation.Title           = model.Title;
            dbOperation.Notes           = model.Notes;
            dbOperation.Created         = DateTime.UtcNow;

            try
            {
                _context.Operation.Add(dbOperation);
                _context.SaveChanges();
                operationId = dbOperation.OperationId;
            }
            catch (Exception exc)
            {
                throw exc;
            }

            return(RedirectToAction("Edit", new { id = operationId }));
        }
        private void buildMembers(Models.DB.Operation dataEntity)
        {
            List <Operations.OperationMemberSummaryItem> members = new List <Operations.OperationMemberSummaryItem>();

            foreach (var item in dataEntity.OperationMember)
            {
                members.Add(new Operations.OperationMemberSummaryItem(item));
            }

            this.Members = members;
        }
 public OperationSummaryItem(Models.DB.Operation dataEntity)
 {
     this.ID = dataEntity.OperationId;
     this.OperationNumber = dataEntity.OperationNumber;
     this.SequenceNumber  = dataEntity.SequenceNumber;
     this.Start           = dataEntity.OperationStart;
     this.End             = dataEntity.OperationEnd;
     this.Title           = dataEntity.Title;
     this.Notes           = dataEntity.Notes;
     buildMembers(dataEntity);
 }