Exemplo n.º 1
0
 public ActionResult Sil(int id)
 {
     if (Request.Cookies["yetki"] == null)
     {
         return(RedirectToAction("Index", "Login"));
     }
     else
     {
         Sorunlar srn = db.Sorunlar.Find(id);
         if (srn.Id > 0)
         {
             db.Sorunlar.Remove(srn);
             db.SaveChanges();
             return(Json(new { success = true, message = "Sorun silindi." }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = true, message = "Sorun bulunamadı." }, JsonRequestBehavior.AllowGet));
         }
     }
 }
Exemplo n.º 2
0
        public ActionResult Ekle(Sorunlar srn)
        {
            if (Request.Cookies["yetki"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                try
                { if (srn.Id == 0)
                  {
                      Sorunlar mdl = new Sorunlar()
                      {
                          RenkId       = srn.RenkId,
                          Sorun        = srn.Sorun,
                          Sure         = srn.Sure,
                          Ucret        = srn.Ucret,
                          YerindeTamir = srn.YerindeTamir
                      };
                      db.Sorunlar.Add(mdl);
                      db.SaveChanges();


                      //return RedirectToAction("Index", "Admin");
                      return(Json(new { success = true, message = "Sorun eklendi." }, JsonRequestBehavior.AllowGet));
                  }
                  else
                  {
                      db.Entry(srn).State = System.Data.Entity.EntityState.Modified;
                      db.SaveChanges();
                      return(Json(new { success = true, message = "Sorun Güncellendi güncellendi" }, JsonRequestBehavior.AllowGet));
                  } }
                catch (Exception ee)
                {
                    return(Json(new { success = true, message = "Bir hata oluştu." }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Exemplo n.º 3
0
        public JsonResult FiyatRemove(string id, List <Sorunlar> FiyatList)
        {
            int             a     = Convert.ToInt32(id);
            List <Sorunlar> bosmu = new List <Sorunlar>();

            try
            {
                if (a == 0)
                {
                    //Sorunlar sr = new Sorunlar()
                    //{
                    //    Id = 0,
                    //    RenkId = 0,
                    //    Sorun = "Diğer",
                    //    Sure = "0",
                    //    Ucret = 0
                    //};
                    FiyatList.Remove(FiyatList.Where(x => x.Id.Equals(0)).FirstOrDefault());
                }
                else
                {
                    Sorunlar mdl = db.Sorunlar.Where(x => x.Id.Equals(a)).First();
                    FiyatList.Remove(FiyatList.Where(x => x.Id.Equals(mdl.Id)).FirstOrDefault());
                }
            }
            catch (Exception ee) { }

            if (FiyatList == null)
            {
                FiyatList = bosmu;
            }
            return(Json(new
            {
                data = FiyatList
            }, JsonRequestBehavior.AllowGet));
        }