예제 #1
0
        public void Create(CreateVehicleViewModel model)
        {
            var eventInfo = new LogEventInfo(LogLevel.Info, _logger.Name, "Vehicle create");
            eventInfo.Properties["ModelName"] = model.Name;

            var vehicleDto = Mapper.Map<VehicleDTO>(model);
            var result =  _vehicleService.AddVehicle(vehicleDto);

            if (result.Status == ServiceResultStatus.Success)
                _logger.Info(eventInfo);
            else _logger.Error(eventInfo);
        }
예제 #2
0
        public ActionResult Create(CreateVehicleViewModel model)
        {
            if (ModelState.IsValid)
            {
                _logics.Create(model);
                SuccessMessage("Автомобиль успешно добавлен");
                return RedirectToAction("Index");
            }

            ViewBag.FuelTypes = _logics.GetFuelTypesSelectList();
            ViewBag.VehicleClasses = _sLogics.GetVehicleClassesSelectList();
            ErrorMessage("При добавлении автомобиля произошла ошибка");
            return View(model);
        }