Пример #1
0
 public ActionResult Edit(About about)
 {
     if (ModelState.IsValid)
     {
         _aboutService.Update(about);
         return(RedirectToAction("Detail"));
     }
     return(View(about));
 }
Пример #2
0
        public async Task <IActionResult> Update([FromBody] JsonModel about)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception(Contants.UNVALID);
            }
            await aboutService.Update(about);

            return(NoContent());
        }
        protected void btnAbout_Click(object sender, EventArgs e)
        {
            try
            {
                int   aboutID = (from a in db.About select a.ID).FirstOrDefault();
                About about   = _aboutService.Get(aboutID);
                Users user    = (Users)Session["user"];

                about.Title          = txtBaslik.Text;
                about.SmallWriting   = txtKucukYazi.Text;
                about.BigWriting     = txtBuyukYazi.Text;
                about.MissionTitle   = txtMissionTitle.Text;
                about.MissionWriting = txtMssionWriting.Text;
                about.PlanTitle      = txtPlanTitle.Text;
                about.PlanWriting    = txtPlanWriting.Text;
                about.VisionTitle    = txtVisionTitle.Text;
                about.VisionWriting  = txtVisionWriting.Text;
                about.Image          = lblInfo.Text;
                about.MissionImage   = lblInfo1.Text;
                about.PlanImage      = lblInfo2.Text;
                about.VisionImage    = lblInfo3.Text;
                //if (Int32.Parse(RadioButtonList1.SelectedItem.Value) == 1)
                //{
                //    about.IsActive = true;
                //}
                //else
                //{
                //    about.IsActive = false;
                //}
                about.ModifiedBy   = user.ID;
                about.ModifiedDate = DateTime.Now;

                _aboutService.Update(about);

                Uyari("Güncelleme işlemi başarılı", true);
            }
            catch (Exception)
            {
                Uyari("Güncelleme işleminde bir hatayla karşılaşıldı", false);
            }
            pnlAlert.Visible = true;
        }