public PeoplesDebatePostViewModel MapFromDataObject(PeoplesDebatPostDataModel model) { Id = model.Id; BillId = model.BillDataModelId; Text = model.Text; Author = model.Author; Date = model.Date; return(this); }
public void AddPeoplesComment(string userId, string newComment, string billId) { var realBillId = Convert.ToInt32(billId); var user = _db.Single <ApplicationUser>(u => u.Id == userId); var bill = _db.Single <BillDataModel>(billDataModel => billDataModel.Id == realBillId); var billCommentDataModel = new PeoplesDebatPostDataModel() { Date = DateTime.Now, Author = user, BillDataModelId = bill.Id, Text = newComment }; _db.Add <PeoplesDebatPostDataModel>(billCommentDataModel); _db.CommitChanges(); }