Example #1
0
        public JsonResult deletePartJson(int partId)
        {
            try
            {
                int deleted = PartProcessor.DeletePart(
                    partId
                    );



                return(Json("Delete"));
            }
            catch
            {
                return(Json("Error"));
            }
        }
Example #2
0
        public ActionResult deletePart(int id)
        {
            int deleted = 0;

            if (ModelState.IsValid)
            {
                try
                {
                    deleted = PartProcessor.DeletePart(
                        id
                        );

                    TempData["newPartResult"] = 2;
                    return(RedirectToAction("ViewParts"));
                }
                catch (Exception ex)
                {
                    TempData["partDeleted"] = deleted;
                    return(RedirectToAction("ViewParts"));
                }
            }

            return(View());
        }