/// <summary> /// Method to create a new comment /// </summary> /// <param name="Entity"></param> /// <returns></returns> public Comment Create(Comment Entity) { Entity.CreatedDate = DateTime.Now; Repo.Insert(Entity); Repo.Save(); return(new Comment()); }
public Comment SaveOrUpdate(Comment comment) { if (comment == null) { throw new ArgumentNullException("comment"); } ProjectSecurity.DemandCreateComment(); if (comment.CreateBy == default(Guid)) { comment.CreateBy = SecurityContext.CurrentAccount.ID; } var now = TenantUtil.DateTimeNow(); if (comment.CreateOn == default(DateTime)) { comment.CreateOn = now; } var newComment = _commentDao.Save(comment); //mark entity as jast readed return(newComment); }
public Comment SaveOrUpdate(Comment comment) { if (comment == null) { throw new ArgumentNullException("comment"); } if (!SecurityContext.CurrentAccount.IsAuthenticated) { throw new System.Security.SecurityException(); } if (comment.CreateBy == default(Guid)) { comment.CreateBy = SecurityContext.CurrentAccount.ID; } DateTime now = TenantUtil.DateTimeNow(); if (comment.CreateOn == default(DateTime)) { comment.CreateOn = now; } var newComment = dao.Save(comment); //mark entity as jast readed // pdao.Read(comment.CreateBy, comment.TargetUniqID, now); return(newComment); }
public void SaveOrUpdate(Comment comment) { if (comment == null) { throw new ArgumentNullException("comment"); } if (comment.CreateBy == default(Guid)) { comment.CreateBy = SecurityContext.CurrentAccount.ID; } var now = TenantUtil.DateTimeNow(); if (comment.CreateOn == default(DateTime)) { comment.CreateOn = now; } commentDao.Save(comment); }