コード例 #1
0
        public bool Save(SaveTutorialContentInputDto inputDTO)
        {
            TutorialContent tt = this.tutorialContentRepository.FindBy(x => x.ID == inputDTO.ID).FirstOrDefault();

            if (tt == null)
            {
                tt = new TutorialContent();
            }

            tt.ParentID          = inputDTO.ParentID;
            tt.Description       = Cmn.GetCompressed(inputDTO.Description);
            tt.DescriptionLength = inputDTO.Description.Length;
            tt.Title             = inputDTO.Title;
            tt.Type = inputDTO.Type;
            tt.Seq  = inputDTO.Seq;

            if (inputDTO.ID == 0)
            {
                this.tutorialContentRepository.Add(tt);
            }
            else
            {
                this.tutorialContentRepository.Update(tt);
            }

            this.unitOfWork.Commit();

            return(true);
        }
コード例 #2
0
    protected void Unnamed1_Click1(object sender, EventArgs e)
    {
        rapidInfoModel.Identity a = rapidInfoModel.Identity.GetData(Cmn.ToInt(lblId.Text));
        if (a == null)
        {
            a = new rapidInfoModel.Identity();
        }

        a.Name          = txtName.Text;
        a.Details       = Cmn.GetCompressed(txtDetails.InnerText);
        a.DetailsLength = txtDetails.InnerText.Length;
        a.Save();


        if (a != null)
        {
            string FileName = @"~\Images\identity\" + a.Id + ".jpg";

            if (FileUpload.HasFile != false)
            {
                try { FileUpload.SaveAs(Server.MapPath(FileName)); RegularExpressionValidator1.Visible = false; }
                catch (Exception ex) { Cmn.LogError(ex, "Image"); }
            }
        }

        WriteClientScript("parent.GetIdentity();");
    }
コード例 #3
0
        public bool Save(SaveQuestionIutputDto inputQuestion)
        {
            QuesList ques = null;

            if (inputQuestion.ID > 0)
            {
                ques = this.questionRepository.FindBy(x => x.ID == inputQuestion.ID).FirstOrDefault();
            }

            if (ques == null)
            {
                ques = new QuesList();
            }

            ques.Question     = inputQuestion.Question;
            ques.Answer       = Cmn.GetCompressed(inputQuestion.Answer);
            ques.AnswerLength = inputQuestion.Answer.Length;
            ques.Language     = inputQuestion.Language;
            ques.Type         = inputQuestion.Type;
            ques.Reviewed     = 1;

            if (inputQuestion.ID == 0)
            {
                this.questionRepository.Add(ques);
            }
            else
            {
                this.questionRepository.Update(ques);
            }

            this.unitOfWork.Commit();
            return(true);
        }