Esempio n. 1
0
        public ActionResult Delete(int id)
        {
            try
            {
                MachineDao mDao = new MachineDao();
                Machine    m    = mDao.GetById(id);

                if (m.SmallImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/Machine/" + m.SmallImageName));
                }
                if (m.BigImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/Machine/" + m.BigImageName));
                }

                mDao.Delete(m);

                TempData["succes"] = "Stroj " + m.Name + " úspěšně smazán.";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult DeletePicture(int id)
        {
            try
            {
                MachineDao mDao = new MachineDao();
                Machine    m    = mDao.GetById(id);

                if (m.SmallImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/Machine/" + m.SmallImageName));
                }
                if (m.BigImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/Machine/" + m.BigImageName));
                }

                m.SmallImageName = null;
                m.BigImageName   = null;

                TempData["succes"] = "Obrázek stroje odstraněn.";

                return(View("Edit", m));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Esempio n. 3
0
        public ActionResult EditFault(int id)
        {
            MachineDao mDao = new MachineDao();

            ViewBag.Mark = "Machine";

            return(View(mDao.GetById(id)));
        }
Esempio n. 4
0
        public ActionResult Detail(int id)
        {
            MachineDao mDao = new MachineDao();
            Machine    mach = mDao.GetById(id);

            ViewBag.Mark = "Machine";
            if (Request.IsAjaxRequest())
            {
                return(PartialView(mach));
            }
            return(View(mach));
        }