Beispiel #1
0
        public ActionResult ItemDetele(int?id)
        {
            ItemBL          bl = new ItemBL();
            List <ItemsDTO> dtResult;
            ItemsDTO        dto = new ItemsDTO();

            dto.id = id;
            bl.SearchData(dto, out dtResult);
            if (dtResult.Count > 0)
            {
                int equal = bl.DeleteData(id);
                if (equal == 1)
                {
                    TempData["Error"]   = "Delete badly";
                    TempData["Success"] = "";
                }
                else
                {
                    TempData["Error"]   = "";
                    TempData["Success"] = "Delete successfully";
                }
            }
            else
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(RedirectToAction("ItemSearch"));
        }
        public ActionResult DeleteItem(string id)
        {
            try
            {
                ItemBL itemBL = new ItemBL();
                itemBL.DeleteData(id.ParseInt32());

                return(RedirectToAction("Item"));
            }
            catch (DataException dex)
            {
                ModelState.AddModelError("", "Lỗi không xác định");
                return(RedirectToAction("SubmissionFailed"));
            }
        }
Beispiel #3
0
        public ActionResult DeleteItem(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                ItemBL itemBL = new ItemBL();

                CommonData.ReturnCode returnCode = itemBL.DeleteData(id.ParseInt32());
                if (CommonData.ReturnCode.Success == returnCode)
                {
                    TempData["Success"]   = "Delete Successful";
                    Session["model.Item"] = null;
                    return(RedirectToAction("Category"));
                }
            }
            return(RedirectToAction("Item"));
        }
Beispiel #4
0
        public ActionResult ItemDeleteMulti(FormCollection frm)
        {
            string[] ids = frm["ItemID"].Split(new char[] { ',' });
            ItemBL   bl  = new ItemBL();
            ItemsDTO dtResult;

            foreach (string item in ids)
            {
                ItemsDTO dto   = new ItemsDTO();
                int      id    = item.ParseInt32();
                int      equal = bl.SearchID(id, out dtResult);
                if (dtResult != null)
                {
                    bl.DeleteData(id);
                }
            }
            return(RedirectToAction("ItemSearch"));
        }