private UserPost ConvertToDM(UserPostBM model) { return(new UserPost { Id = model.Id, UserId = model.UserId, Subject = model.Subject, Post = model.Post, CreatedBy = model.CreatedBy, CreationDate = model.CreationDate, ModifiedBy = model.ModifiedBy, ModificationDate = model.ModificationDate }); }
public ActionResult PostComment(PostCommentModel Model) { UserBM CurrentUser = (UserBM)Session["User"]; if (CurrentUser != null) { UserPostBM UserPostBM = new UserPostBM(); UserPostBM.Post = Model.UserPost.Post; UserPostBM.Subject = Model.UserPost.Subject; UserPostBM.UserId = CurrentUser.Id; UserPostBM.CreatedBy = CurrentUser.Id; UserPostBM.CreationDate = DateTime.Now; UserPostBL.Create(UserPostBM); TempData["Success"] = "Record saved Successfully."; } else { TempData["Error"] = "Please Login."; } return(RedirectToAction("UserPost")); }
public void Update(UserPostBM model) { uow.UserPostRepository.Update(ConvertToDM(model)); uow.Save(); }
public void Create(UserPostBM model) { uow.UserPostRepository.Add(ConvertToDM(model)); uow.Save(); }