public static void AddComment(Comment comment) { CommentsDataSource comDS = new CommentsDataSource(); CommentEntry comm = new CommentEntry(); Converter.CopyFields(comment, comm); comDS.AddComment(comm); }
public static Comment FromTableEntry(CommentEntry comm) { return new Comment() { RowKey = comm.RowKey, Author = comm.Username, Body = comm.Comment, ParentName = comm.DatasetId, ParentType = comm.ParentType, ParentContainer = comm.PartitionKey, Posted = comm.PostedOn, Status = comm.Status, Subject = comm.Subject, Notify = comm.Notify, Type = comm.Type, Email = comm.Email }; }
public static CommentEntry CopyFields(Comment source, CommentEntry target) { if(!String.IsNullOrEmpty(source.RowKey)) target.RowKey = source.RowKey; target.Username = source.Author; target.Comment = source.Body; target.DatasetId = source.ParentName; target.ParentType = source.ParentType; target.PartitionKey = source.ParentContainer; target.PostedOn = source.Posted; target.Status = source.Status; target.Subject = source.Subject; target.Type = source.Type; target.Notify = source.Notify; target.Email = source.Email; return target; }
private static string GetParentDisplayName(CommentEntry comm, Dictionary<string, string> requests, Dictionary<string, string> entities) { String result; if(comm.ParentType == "Request") { requests.TryGetValue(comm.DatasetId, out result); } else { entities.TryGetValue(comm.PartitionKey + comm.DatasetId, out result); } return result; }
public void Update(CommentEntry entry) { //TODO when all this wil be configured in some way, until then we can't do anything }
public void AddComment(CommentEntry item) { //TODO when all this wil be configured in some way, until then we can't do anything //this.context.AddObject("Comments", item); //this.context.SaveChanges(); }