public ActionResult Edit(VehicleManufacturerList model)
        {
            SetActiveMenuItem();
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                //Set our updater name
                var FullName = Request.Cookies["userInfo"]["FullName"];

                //Now update the record
                ManufacturerBLL.UpdateManufacturer(model, FullName);

                //Take our ID with us to the confirmation form
                ViewBag.Id = model.Id;

                //Determine the kind of SQL transaction we have performed
                ViewBag.Message = "updated";

                //We can now safely go to the confirmation view
                return(View("AddUpdateConfirm"));
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(Redirect("~/Admin/Home/Error"));
            }
        }
        public ActionResult Create(VehicleManufacturerList model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                //Set our iniotal return value
                var returnValue = 0;
                //Set our updater name
                var FullName = Request.Cookies["userInfo"]["FullName"];
                //Attempt to add our record
                ManufacturerBLL.AddManufacturer(model, FullName, out returnValue);

                //Take our ID with us to the confirmation form
                ViewBag.Id = returnValue;

                //Determine the kind of SQL transaction we have performed
                ViewBag.Message = "added";

                //We can now safely go to the confirmation view
                return(View("AddUpdateConfirm"));
            }

            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(Redirect("~/Admin/Home/Error"));
            }
        }
示例#3
0
        public static VehicleManufacturerList GetManufacturer(int ManufacturerID)
        {
            var model = new VehicleManufacturerList();
            var dt    = ManufacturerDAL.GetManufacturer(ManufacturerID);
            var dr    = dt.Rows[0];

            model.Id      = (int)dr["ManufacturerID"];
            model.Display = dr["Manufacturer"].ToString();
            return(model);
        }
示例#4
0
 public static void AddManufacturer(VehicleManufacturerList model, string UpdatedBy, out int returnValue)
 {
     ManufacturerDAL.AddManufacturer(model.Display, UpdatedBy, out returnValue);
 }
示例#5
0
 public static void UpdateManufacturer(VehicleManufacturerList model, string UpdatedBy)
 {
     ManufacturerDAL.UpdateManufacturer(model.Id, model.Display, UpdatedBy);
 }