Exemplo n.º 1
0
        // GET: Files/Edit/5
        public ActionResult Edit(int id)
        {
            if (user == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            sertifikalar co = datas.sertifikalars.Where(t => t.id == id).FirstOrDefault();

            return(View(co));
        }
Exemplo n.º 2
0
        public ActionResult Create(FormCollection frm)
        {
            sertifikalar srf = new sertifikalar();


            srf.name = frm["name"].ToString();



            if (Request.Files.Count > 0)
            {
                string path = Server.MapPath("/");
                srf.folder = path;


                if (Directory.Exists(path + "/Belgeler") == false)
                {
                    Directory.CreateDirectory(path + "Belgeler/");
                }
                if (!string.IsNullOrEmpty(Request.Files["pic"].FileName))
                {
                    Request.Files["pic"].SaveAs(path + "Belgeler/" + Request.Files["pic"].FileName);
                }
            }



            srf.folder = string.IsNullOrEmpty(Request.Files["pic"].FileName) == true ? "" : "Belgeler/" + Request.Files["pic"].FileName;



            try
            {
                // TODO: Add insert logic here
                datas.sertifikalars.Add(srf);

                datas.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id, FormCollection frm)
        {
            sertifikalar srf = datas.sertifikalars.Where(a => a.id == id).FirstOrDefault();


            srf.name = frm["name"].ToString();

            if (Request.Files.Count > 0)
            {
                string path = Server.MapPath("/");


                if (!string.IsNullOrEmpty(Request.Files["pic"].FileName))
                {
                    Request.Files["pic"].SaveAs(path + "Belgeler/" + Request.Files["pic"].FileName);
                }

                if (string.IsNullOrEmpty(Request.Files["pic"].FileName) == false)
                {
                    srf.folder = "Belgeler/" + Request.Files["pic"].FileName;
                }
            }


            try
            {
                // TODO: Add insert logic here


                datas.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 4
0
        public ActionResult detay(int id)
        {
            sertifikalar al = datas.sertifikalars.Where(a => a.id == id).FirstOrDefault();

            return(View(al));
        }