Example #1
0
        public IActionResult Create(HomeViewModel home)
        {
            //if (ModelState.IsValid)
            //{
            if (home.Image != null)
            {
                var fileName = ImageHelpers.GetUniqueName(home.Image.FileName);
                home.HomeImg = fileName;
                var uploads  = $"{@"C:\YeniEmlakImages\"}";
                var filePath = Path.Combine(uploads, fileName);
                using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create))
                {
                    home.Image.CopyTo(fileStream);
                }
            }

            homeRepo.Create(HomeViewModel.MapHomeViewModelToHome(home));
            return(RedirectToAction("Index"));
            //}
            //else
            //{
            //    var errors = ModelState.Values.SelectMany(v => v.Errors);
            //}
            // return View("AddHome", home);
        }
Example #2
0
 public void Create(Home t)
 {
     //İş kurulları uygulanacak
     _homerepository.Create(t);
 }
Example #3
0
 public void Create(Home newHome)
 {
     _homeRepository.Create(newHome);
 }
Example #4
0
 private void CreateHome(long idClient, RequestClientDto requestClientDto)
 {
     requestClientDto.IdClient = idClient;
     _homeRepository.Create(_mapper.Map <HomeEntity>(requestClientDto));
 }