public long AddProfileActionComment(ProfileActionComment addComment) { ProfileAction profileAction = context .ProfileActions .Where(m => m.ProfileActionId == addComment.ProfileActionId) .FirstOrDefault(); if (profileAction != null) { context.ProfileActionsComments.Add(addComment); context.SaveChanges(); } return addComment.ProfileActionCommentId; }
public ActionResult AddComment(ProfileActionComment value) { LoadCommentResult result = new LoadCommentResult(); result.Profile = ProfileRepository.GetProfile(user.ProfileId); result.Action = ProfileRepository.GetProfileAction((long)value.ProfileActionId); if (user.ProfileId == value.ProfileId) { value.Date = DateTime.Now; long id = ProfileRepository.AddProfileActionComment(value); result.ProfileActionComment = ProfileRepository.GetProfileActionsComment(id); } return PartialView("LoadComment", result); }
public void RemoveComment(ProfileActionComment value) { ProfileActionComment check = ProfileRepository.GetProfileActionsComment(value.ProfileActionCommentId); if (check != null) { ProfileAction check2 = ProfileRepository.GetProfileAction((long)check.ProfileActionId); if ((user.ProfileId == check.ProfileId) || (user.ProfileId == check2.ProfileId)) { ProfileRepository.RemoveProfileActionComment(value.ProfileActionCommentId); } } }