Пример #1
0
        public ActionResult newPart(Part part)
        {
            int created = 0;

            if (ModelState.IsValid)
            {
                try
                {
                    created = PartProcessor.CreatePart(
                        part.partName,
                        part.side);



                    TempData["newPartResult"] = created;
                    return(RedirectToAction("ViewParts"));
                }
                catch (Exception ex)
                {
                    TempData["newPartResult"] = "An error has occurred!";
                    return(RedirectToAction("ViewParts"));
                }
            }

            return(View());
        }
Пример #2
0
        public static int addNewPart(Part part)
        {
            int created = 0;

            try
            {
                created = PartProcessor.CreatePart(
                    part.partName,
                    part.side);

                //


                return(created);
            }
            catch (Exception ex)
            {
                // TempData["newPartResult"] = "An error has occurred!";
                return(created);
            }
        }