示例#1
0
        public async Task <ActionResult> Delete(OfferDto value)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await db.Delete(value);

                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            return(View("index"));
        }
示例#2
0
 public ActionResult Delete(int?id)
 {
     if (Session["Customer_id"] != null)
     {
         if (Session["UserName"].ToString() == "ADMIN1" || Session["UserName"].ToString() == "ADMIN2")
         {
             TempData["Message"] = Offer.Delete(id.Value);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("Index", "Home"));
         }
     }
     else
     {
         return(RedirectToAction("Login", "MyAccount"));
     }
 }