public static Common.Models.Notes.Note Edit(Common.Models.Notes.Note model, Common.Models.Account.Users modifier) { model.ModifiedBy = modifier; model.Modified = DateTime.UtcNow; DBOs.Notes.Note dbo = Mapper.Map <DBOs.Notes.Note>(model); using (IDbConnection conn = Database.Instance.GetConnection()) { conn.Execute("UPDATE \"note\" SET " + "\"title\"=@Title, \"body\"=@Body, \"timestamp\"=@Timestamp, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " + "WHERE \"id\"=@Id", dbo); } return(model); }
public static Common.Models.Notes.Note Create(Common.Models.Notes.Note model, Common.Models.Account.Users creator) { if (!model.Id.HasValue) { model.Id = Guid.NewGuid(); } model.CreatedBy = model.ModifiedBy = creator; model.Created = model.Modified = DateTime.UtcNow; DBOs.Notes.Note dbo = Mapper.Map <DBOs.Notes.Note>(model); using (IDbConnection conn = Database.Instance.GetConnection()) { conn.Execute("INSERT INTO \"note\" (\"id\", \"title\", \"body\", \"timestamp\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " + "VALUES (@Id, @Title, @Body, @Timestamp, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)", dbo); } return(model); }
public static Common.Models.Notes.Note Edit( Common.Models.Notes.Note model, Common.Models.Account.Users modifier, IDbConnection conn = null, bool closeConnection = true) { model.ModifiedBy = modifier; model.Modified = DateTime.UtcNow; DBOs.Notes.Note dbo = Mapper.Map <DBOs.Notes.Note>(model); conn = DataHelper.OpenIfNeeded(conn); conn.Execute("UPDATE \"note\" SET " + "\"title\"=@Title, \"body\"=@Body, \"timestamp\"=@Timestamp, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " + "WHERE \"id\"=@Id", dbo); DataHelper.Close(conn, closeConnection); return(model); }
public static Common.Models.Notes.Note Create( Common.Models.Notes.Note model, Common.Models.Account.Users creator, IDbConnection conn = null, bool closeConnection = true) { if (!model.Id.HasValue) { model.Id = Guid.NewGuid(); } model.CreatedBy = model.ModifiedBy = creator; model.Created = model.Modified = DateTime.UtcNow; DBOs.Notes.Note dbo = Mapper.Map <DBOs.Notes.Note>(model); conn = DataHelper.OpenIfNeeded(conn); conn.Execute("INSERT INTO \"note\" (\"id\", \"title\", \"body\", \"timestamp\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " + "VALUES (@Id, @Title, @Body, @Timestamp, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)", dbo); DataHelper.Close(conn, closeConnection); return(model); }