public ActionResult AddComment(ApartmentComment apartmentComment) { InfoApartmentCommentResult result = new InfoApartmentCommentResult(); if(ApartmentRepository.IsApartmentExists((long)apartmentComment.ApartmentId)) { apartmentComment.Date = DateTime.Now; ApartmentRepository.AddApartmentComment(apartmentComment); } result.Me = ProfileRepository.GetProfile(user.ProfileId); result.Apartment = ApartmentRepository.GetApartment((long)apartmentComment.ApartmentId); result.Comment = ApartmentRepository.GetApartmentComment(apartmentComment.ApartmentCommentId); return PartialView("_InfoComment", result); }
public void AddApartmentComment(ApartmentComment apartmentComment) { context.ApartmentComments.Add(apartmentComment); context.SaveChanges(); }