示例#1
0
        public void RemoveApartmentComment(long apartmentCommentId)
        {
            ApartmentComment comment = context.ApartmentComments.Find(apartmentCommentId);

            if (comment != null)
            {
                context.ApartmentComments.Remove(comment);
                context.SaveChanges();
            }
        }
示例#2
0
        public void RemoveComment(long?id)
        {
            ApartmentComment comment   = ApartmentRepository.GetApartmentComment((long)id);
            Apartment        apartment = ApartmentRepository.GetApartment((long)comment.ApartmentId);

            if (comment != null)
            {
                if ((comment.ProfileId == user.ProfileId) || (apartment.ProfileId == user.ProfileId))
                {
                    ApartmentRepository.RemoveApartmentComment((long)id);
                }
            }
        }
示例#3
0
        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));
        }
示例#4
0
 public void AddApartmentComment(ApartmentComment apartmentComment)
 {
     context.ApartmentComments.Add(apartmentComment);
     context.SaveChanges();
 }