Beispiel #1
0
        public ActionResult AddTool(ToolModelView model)
        {
            if (ModelState.IsValid)
            {
                var tool = new TOOL()
                {
                    GUIDID         = Guid.NewGuid(),
                    Name           = model.Name,
                    UnitCost       = model.UnitCost,
                    Unit           = model.Unit,
                    Type           = model.Type,
                    CreationDate   = DateTime.Now,
                    CreatedBy      = User.Identity.Name,
                    LastModifiedBy = User.Identity.Name
                };

                try
                {
                    db.TOOLs.Add(tool);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    return(View("Error", new HandleErrorInfo(ex, "Jobs", "Index")));
                }

                return(RedirectToAction("Index"));
            }
            // Something failed, return
            return(View(model));
        }
Beispiel #2
0
        public ActionResult AddTool()
        {
            ToolModelView JMV = new ToolModelView();

            return(View(JMV));
        }