Beispiel #1
0
        //public IActionResult Delete(int id)
        //{
        //    SystemUser p = ORM.SystemUser.Find(id);
        //    if (p != null)
        //    {
        //        ORM.SystemUser.Remove(p);
        //        ORM.SaveChanges();
        //        TempData["Message"] = p.UserName + "Deleted Successfully";
        //        return RedirectToAction("Alluser");
        //    }
        //    return View();
        //}

        public string Delete(int id)
        {
            try
            {
                SystemUser u = ORM.SystemUser.Find(id);

                if (u != null)
                {
                    ORM.SystemUser.Remove(u);
                    ORM.SaveChanges();
                    TempData["Message"] = u.UserName + "Deleted Successfully";
                    return("1");
                }
            }
            catch
            {
                return("0");
            }
            finally
            {
            }


            return("0");
        }
        // GET: Products/Delete/5
        //public async Task<IActionResult> Delete(int? id)
        //{
        //    if (id == null)
        //    {
        //        return NotFound();
        //    }

        //    var product = await ORM.Product
        //        .FirstOrDefaultAsync(m => m.Id == id);
        //    if (product == null)
        //    {
        //        return NotFound();
        //    }

        //    return View(product);
        //}
        //GET: Products/Delete/5
        public string Delete(int id)
        {
            try
            {
                Product p = ORM.Product.Find(id);

                if (p != null)
                {
                    ORM.Product.Remove(p);
                    ORM.SaveChanges();
                    TempData["Message"] = p.Name + "Deleted Successfully";
                    return("1");
                }
            }
            catch
            {
                return("0");
            }
            finally
            {
            }


            return("0");
        }
        //GET: Categories/Delete/5
        //public async Task<IActionResult> Delete(int? id)
        //{
        //    if (id == null)
        //    {
        //        return NotFound();
        //    }

        //    var category = await ORM.Category
        //        .FirstOrDefaultAsync(m => m.Id == id);
        //    if (category == null)
        //    {
        //        return NotFound();
        //    }

        //    return View(category);
        //}
        public string Delete(int id)
        {
            try
            {
                Category c = ORM.Category.Find(id);

                if (c != null)
                {
                    ORM.Category.Remove(c);
                    ORM.SaveChanges();
                    TempData["Message"] = c.Name + "Deleted Successfully";
                    return("1");
                }
            }
            catch
            {
                return("0");
            }
            finally
            {
            }


            return("0");
        }