public int Create(UserPostCommentBM model) { UserPostComment commentDM = ConvertToDM(model); uow.UserPostCommentRepository.Add(commentDM); uow.Save(); return commentDM.Id; }
private UserPostComment ConvertToDM(UserPostCommentBM model) { if (model == null) return null; else return new UserPostComment { Id = model.Id, UserId=model.UserId, Comment=model.Comment, PostId=model.PostId, CreatedBy=model.CreatedBy, CreationDate=model.CreationDate, ModifiedBy = model.ModifiedBy, ModificationDate = model.ModificationDate }; }
public void DeleteComment(UserPostCommentBM commentBM) { UserPostCommentCommentBL commentbl = new UserPostCommentCommentBL(); commentbl.Delete(commentBM); }
public JsonResult PostComment(UserPostCommentBM commentBM) { UserPostCommentCommentBL commentbl = new UserPostCommentCommentBL(); UserBM userObj = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User); commentBM.UserName = userObj.Name; commentBM.UserId = userObj.Id; commentBM.CreatedBy = userObj.Id; commentBM.CreationDate = DateTime.Now; int CommentId = commentbl.Create(commentBM); commentBM.Id = CommentId; return Json(commentBM); }
public JsonResult EditComment(UserPostCommentBM commentBM) { UserPostCommentCommentBL commentbl = new UserPostCommentCommentBL(); UserBM userObj = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User); commentBM.ModifiedBy = userObj.Id; commentBM.ModificationDate = DateTime.UtcNow; //date issue http://www.devcurry.com/2013/04/json-dates-are-different-in-aspnet-mvc.html#.Ufvl1Y3VD6Q //date issue for ko MVC if (commentBM.CreationDate.ToString() == "1/1/0001 12:00:00 AM") { commentBM.CreationDate = DateTime.Now; } commentbl.Update(commentBM); return Json(commentBM); }
public void Update(UserPostCommentBM model) { uow.UserPostCommentRepository.Update(ConvertToDM(model)); uow.Save(); }