Beispiel #1
0
        public ProblemEidtForm(ProblemWithTypeName CurSelProblemWithTN, IKnowltAndProblemFormReq IKnowltAndProblemFormReq, EditProblem editProblem)
        {
            InitializeComponent();
            this.IKnowltAndProblemFormReq = IKnowltAndProblemFormReq;
            this.CurSelProblemWithTN      = CurSelProblemWithTN;
            this.editProblem         = editProblem;
            this.iProblemEditFormReq = ImplProblemEditFormReq.NewInstance();

            this.initData();
            this.initView();
        }
Beispiel #2
0
        private void btnEditProblem_Click(object sender, EventArgs e)
        {
            if (CurSelProblemWithTN == null)
            {
                MessageBox.Show(this.tipSelProblem); return;
            }

            EditProblem     editProblem     = new EditProblem(this.EditProblem);
            ProblemEidtForm problemEidtForm = new ProblemEidtForm(this.CurSelProblemWithTN, this.IKnowltAndProblemFormReq, editProblem);

            problemEidtForm.ShowDialog();
        }
        public async Task <IActionResult> Edit(int id)
        {
            var problem = await Repository.Problem.Get(id);

            var user = await GetRequestUser();

            if (user.UserId != problem.Author.UserId)
            {
                throw new Exception("User is not author!");
            }

            var editProblem = new EditProblem(id, HttpContext.User.Identity.IsAuthenticated, HttpContext.User.Identity.Name);

            return(View(editProblem));
        }