Exemplo n.º 1
0
        public VehicleMakemodelMapping GetMakeModelIDList(VehicleMakemodelMapping mapping, decimal VmakeId, decimal VmodelId)
        {
            mapping = (from mmm in _modelContext.VehicleMakemodelMapping
                       where mmm.VmakeId.Equals(VmakeId) &&
                       mmm.VmodelId.Equals(VmodelId) &&
                       mmm.IsActive.Equals('Y')
                       select mmm).FirstOrDefault();

            return(mapping);
        }
Exemplo n.º 2
0
        public IActionResult Create(VehiclesModel vehicles, IFormCollection formCollection)
        {
            IActionResult           returnpath = View(vehicles);
            VehicleMakemodelMapping mapping    = new VehicleMakemodelMapping();

            //var _modelContext = new VehiclesContext();

            try
            {
                Validation(vehicles);

                decimal VmakeId  = Convert.ToDecimal(HttpContext.Request.Form["VmakeId"]);
                decimal VmodelId = Convert.ToDecimal(HttpContext.Request.Form["VmodelId"]);
                mapping = _vehicleService.GetMakeModelIDList(mapping, VmakeId, VmodelId);

                if (ModelState.IsValid)
                {
                    if (mapping != null)
                    {
                        var record = new VehicleRecords()
                        {
                            VmmpId = mapping.VmmpId
                        };

                        _modelContext.VehicleRecords.Add(record);
                        _modelContext.SaveChanges();

                        decimal id = record.VrId;

                        if (id != 0)
                        {
                            _vehicleService.InsertIntoVehicleRecordProperties(vehicles, id);
                        }
                    }
                    returnpath = RedirectToAction("Index");
                }
                else
                {
                    ViewBag.ListOfVehicles = _vehicleService.LoadVehicleTypeList();
                    returnpath             = View(vehicles);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(" Exception on creating new record: " + ex);
            }
            return(returnpath);
        }
Exemplo n.º 3
0
 public VehicleMakemodelMapping GetMakeModelIDList(VehicleMakemodelMapping mapping, decimal VmakeId, decimal VmodelId)
 {
     return(_vehicleRepository.GetMakeModelIDList(mapping, VmakeId, VmodelId));
 }