public Task <CarCreateResponseDto> Create(CarCreateRequestDto carDto) { var car = _mapper.Map <CarCreateRequestDto, CarEntity>(carDto); var result = _carsRepository.Create(car); return(Task.FromResult(_mapper.Map <CarEntity, CarCreateResponseDto>(result))); }
public async Task <bool> Create(Car entity, string userId) { await _repository.Create(entity); await _repository.SaveChangesAsync(); var car = await _repository.GetIQueryableCars() .FirstOrDefaultAsync(c => c.UniqueNumber == entity.UniqueNumber); CustomUser user; if (userId != string.Empty) { user = await _identityService.FindUser(userId); if (car != null && user != null) { var carId = car.Id; var result = await _repository.AddVehicleRelationToUser(carId, userId); if (result > 0) { return(true); } } } return(false); }
public async Task <ActionResult> Create(VMCars carEntity) { if (ModelState.IsValid) { carEntity.Car.ModPerson = _businessLogic.CheckIfUserIsAuthAndReturnName(); _carsRepository.Create(carEntity.Car); var model = new Email().CreateEmailModel(carEntity.Car.ModPerson.Contains("Niezalogowany") ? EmailType.OtherUser : EmailType.UserAuth); await _emailAdapter.SendEmail(model); return(RedirectToAction("Index")); } return(View(carEntity)); }
public IActionResult Create([Bind("Brand,Name")] Car car) { if (ModelState.IsValid) { _carsRepository.Create(car.Brand, car.Name); return(RedirectToAction("Index")); } return(View(car)); }
public void Create(CarModel carmodel) { var car = new Car { Id = carmodel.Id, Name = carmodel.Name }; repository.Create(car); }
public ActionResult Create(VMCars carEntity) { if (ModelState.IsValid) { carEntity.Car.ModPerson = _businessLogic.CheckIfUserIsAuthAndReturnName(); _carsRepository.Create(carEntity.Car); return(RedirectToAction("Index")); } return(View(carEntity)); }
public void Create(CarModel carmodel) { var car = new Car { Name = carmodel.Name, Parts = carmodel.Parts.Select(x => new Detail { CarId = x.CarId, Name = x.Name, Price = x.Price }).ToList() }; repository.Create(car); }
public async Task <ActionResult> Create(VMCars carEntity) { if (ModelState.IsValid) { carEntity.Car.ModPerson = _businessLogic.CheckIfUserIsAuthAndReturnName(); _carsRepository.Create(carEntity.Car); var model = new EmailApiModel(); model.To = "doKogo"; await _emailClient.Post(model); return(RedirectToAction("Index")); } return(View(carEntity)); }
public async Task <ActionResult> Create(VMCars carEntity) { if (ModelState.IsValid) { carEntity.Car.ModPerson = _carBusinessLogic.CheckIfUserIsAuthAndReturnName(); _carsRepository.Create(carEntity.Car); var client = new Client(); var model = new EmailApiModel(); model.To = "*****@*****.**"; await client.SendEmail(model); return(RedirectToAction("Index")); } return(View(carEntity)); }
public async Task <ActionResult> Create(VMCars carEntity) { if (ModelState.IsValid) { carEntity.Car.ModPerson = _businessLogic.CheckIfUserIsAuthAndReturnName(); _carsRepository.Create(carEntity.Car); var client = new Client(); var model = new ContactForm(); model.Email = "*****@*****.**"; model.Body = "message"; model.Subject = "Test"; var email = await client.SendEmail(model); return(RedirectToAction("Index")); } return(View(carEntity)); }
public void Create(Car car) { _validator.ValidateCreationFieldsAreFilled(car); _carsRepository.Create(car); }