Esempio n. 1
0
        public ActionResult lastopp(HttpPostedFileBase fil)
        {
            var kundebll = new KundeBLL();

            if (fil != null)
            {
                string kat   = kundebll.getkate(System.IO.Path.GetFileName(fil.FileName));
                string bilde = System.IO.Path.GetFileName(fil.FileName);
                string path  = System.IO.Path.Combine(Server.MapPath("~/Bilder/" + kat), bilde);
                fil.SaveAs(path);

                using (MemoryStream ms = new MemoryStream())
                {
                    fil.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                }
            }
            return(RedirectToAction("Opprettprodukt"));
        }
Esempio n. 2
0
        public ActionResult slettprodukt(int id)
        {
            var    Kundebll = new KundeBLL();
            string bilde    = Kundebll.getpath(id);
            string map      = Kundebll.getkate(bilde);
            string path     = System.IO.Path.Combine(Server.MapPath("~/Bilder/" + map), bilde);

            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
            }
            if (Kundebll.slettprodukt(id))
            {
                return(RedirectToAction("ListAlleProdukter"));
            }
            else
            {
                return(HttpNotFound());
            }
        }