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

                //Now update the record
                TransmissionTypeBLL.UpdateTransmissionType(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(VehicleTransmissionList model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                //Set our initial return value
                var returnValue = 0;
                //Set our updater name
                var FullName = Request.Cookies["userInfo"]["FullName"];
                //Attempt to add our record
                TransmissionTypeBLL.AddTransmissionType(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"));
            }
        }
Beispiel #3
0
        public static VehicleTransmissionList GetTransmissionType(int TransmissionID)
        {
            var model = new VehicleTransmissionList();
            var dt    = TransmissionTypeDAL.GetTransmissionType(TransmissionID);
            var dr    = dt.Rows[0];

            model.Id      = (int)dr["TransmissionID"];
            model.Display = dr["TransmissionType"].ToString();
            return(model);
        }
Beispiel #4
0
        public async Task Init()
        {
            if (VehicleFuelTypeList.Count == 0)
            {
                var vfList = await _vehicleFuelService.Get <List <VehicleFuelTypeModel> >(null);

                foreach (var x in vfList)
                {
                    VehicleFuelTypeList.Add(x);
                }
            }

            if (VehicleTransmissionList.Count == 0)
            {
                var vtList = await _vehicleTransmissionService.Get <List <VehicleTransmissionTypeModel> >(null);

                foreach (var x in vtList)
                {
                    VehicleTransmissionList.Add(x);
                }
            }

            if (SelectedFuelType != null || SelectedTransmissionType != null)
            {
                VehicleSearchRequest request = new VehicleSearchRequest();
                if (SelectedFuelType != null)
                {
                    request.VehicleFuelTypeId = SelectedFuelType.VehicleFuelTypeId;
                }
                if (SelectedTransmissionType != null)
                {
                    request.VehicleTransmissionTypeId = SelectedTransmissionType.VehicleTransmissionTypeId;
                }

                await LoadVehicles(request);
                await LoadRecommendedVehicles(request);
            }

            if (SelectedFuelType == null && SelectedTransmissionType == null)
            {
                await LoadVehicles();
                await LoadRecommendedVehicles();
            }
        }
Beispiel #5
0
 public static void AddTransmissionType(VehicleTransmissionList model, string UpdatedBy, out int returnValue)
 {
     TransmissionTypeDAL.AddTransmissionType(model.Display, UpdatedBy, out returnValue);
 }
Beispiel #6
0
 public static void UpdateTransmissionType(VehicleTransmissionList model, string UpdatedBy)
 {
     TransmissionTypeDAL.UpdateTransmissionType(model.Id, model.Display, UpdatedBy);
 }