コード例 #1
0
ファイル: Repository.cs プロジェクト: Narelle/ASPWD2
        public bool ApproveSurvey(Approval approval)
        {
            try
            {
                // Create new record in approvals table
                _context.AddToApprovals(approval);

                // Update record in survey table
                Survey survey = _context.Surveys.Where(e => e.ID == approval.Survey).FirstOrDefault();
                survey.Approved = 1;

                // Save both
                _context.SaveChanges();

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
コード例 #2
0
ファイル: SurveyData.Designer.cs プロジェクト: Narelle/ASPWD2
 /// <summary>
 /// Create a new Approval object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="survey">Initial value of the Survey property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="adminID">Initial value of the AdminID property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="comment">Initial value of the Comment property.</param>
 public static Approval CreateApproval(global::System.Int32 id, global::System.Int32 survey, global::System.Int32 status, global::System.String adminID, global::System.DateTime date, global::System.String comment)
 {
     Approval approval = new Approval();
     approval.ID = id;
     approval.Survey = survey;
     approval.Status = status;
     approval.AdminID = adminID;
     approval.Date = date;
     approval.Comment = comment;
     return approval;
 }
コード例 #3
0
ファイル: SurveyData.Designer.cs プロジェクト: Narelle/ASPWD2
 /// <summary>
 /// Deprecated Method for adding a new object to the Approvals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToApprovals(Approval approval)
 {
     base.AddObject("Approvals", approval);
 }