Esempio n. 1
0
        public ProposalDraft SaveDraft(ProposalDraft draft)
        {
            draft.Id = 0;
            draft    = _db.ProposalDrafts.Add(draft);
            _db.SaveChanges();

            var action = _db.ProposalDraftActions.Add(draft, "draft");

            _db.SaveChanges();

            _db.ProposalCurrentActions.AddOrUpdate(action);
            _db.SaveChanges();

            return(draft);
        }
Esempio n. 2
0
        public void Create(ProposalDraft draft)
        {
            var userId = GetUserId();

            var proposal = new Proposal
            {
                UserId = userId
            };

            proposal = _db.Proposals.Add(proposal);
            _db.SaveChanges();

            draft.UserId     = userId;
            draft.ProposalId = proposal.Id;
            draft            = _db.ProposalDrafts.Add(draft);
            _db.SaveChanges();

            var action = _db.ProposalDraftActions.Add(draft, "draft");

            _db.SaveChanges();

            _db.ProposalCurrentActions.AddOrUpdate(action);
            _db.SaveChanges();
        }
Esempio n. 3
0
 public static ProposalDraftAction Add(this IDbSet <ProposalDraftAction> actions, ProposalDraft draft, string type,
                                       ApprovalStatus approvalStatus = ApprovalStatus.None)
 {
     return(actions.Add(new ProposalDraftAction
     {
         DraftId = draft.Id,
         Draft = draft,
         Type = type,
         ApprovalStatus = approvalStatus
     }));
 }