Beispiel #1
0
        public JsonResult DuyuruSilme(int id)
        {
            UI_Notice Notice = uI_NoticeService.Get(x => x.id == id, CurrentLanguage.id);

            if (Notice != null)
            {
                Notice.IsActive = false;
                uI_NoticeService.Save();
                return(Json("Başarılı"));
            }
            return(Json("Basarisiz"));
        }
Beispiel #2
0
 public IActionResult Duyuru(NoticeViewModel model)
 {
     if (ModelState.IsValid)
     {
         bool          error        = false;
         StringBuilder ErrorMassage = new StringBuilder();
         if (model.StartDate > model.EndDate)
         {
             ErrorMassage.AppendLine("Baslangic tarihiniz bitis tarihinden sonra olamaz.");
             error = true;
         }
         if (string.IsNullOrWhiteSpace(model.Content))
         {
             ErrorMassage.AppendLine("Duyuru icerigi bos olamaz");
             error = true;
         }
         if (!error)
         {
             UI_Notice uI_Notice = new UI_Notice()
             {
                 Content      = model.Content,
                 StartDate    = model.StartDate,
                 EndDate      = model.EndDate,
                 WebSite      = CurrentWebsite,
                 Language     = CurrentLanguage,
                 CreateUserid = LoginUser.id
             };
             uI_NoticeService.Add(uI_Notice);
             uI_NoticeService.Save();
         }
         else
         {
             ViewBag.CreateError = ErrorMassage.ToString();
             return(View(model));
         }
     }
     return(View(new NoticeViewModel()));
 }