public ActionResult SaveApartament(Apartament apartament) { if(!ModelState.IsValid) return View("Rent", apartament); apartament.UserId = User.GetUserInfo().Id; apartament.CreateDate = DateTime.Now; _apartamentService.SaveApartament(apartament); return RedirectToAction("UserPage", "Account"); }
public bool SaveApartament(Apartament apartament) { bool result; if (apartament.Id != 0) { result = _apartamentRepository.UpdateAparament(apartament); } else { result = _apartamentRepository.CreateAparament(apartament); if (result) { } } return result; }