public IActionResult Create(CreateHouseViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var house = _houseService.GetByCounterNumber(model.CounterNumber); if (house == null) { var newHouse = new House { IdentificationNumber = model.IdentificationNumber, Name = model.Name, Surname = model.Surname, Address = model.Address, CounterNumber = model.CounterNumber, ChiefId = User.Identity.GetId(), CreatedDate = DateTime.Now }; _houseService.Create(newHouse); _actionService.Create(new Core.Domain.Action { Endeks = 0, Price = 0, Description = string.Empty, Type = Core.Domain.Type.Read, CreatedDate = DateTime.Now, HouseId = newHouse.Id }); return(View("Success")); } ModelState.AddModelError(string.Empty, "Bu sayaç numarasına ait bir hane zaten mevcut"); return(View(model)); }